]>
Commit | Line | Data |
---|---|---|
ad1a1798 | 1 | /** @file\r |
2 | Status code driver for IA32/X64/EBC architecture.\r | |
3 | \r | |
4 | Copyright (c) 2006, Intel Corporation \r | |
5 | All rights reserved. This program and the accompanying materials \r | |
6 | are licensed and made available under the terms and conditions of the BSD License \r | |
7 | which accompanies this distribution. The full text of the license may be found at \r | |
8 | http://opensource.org/licenses/bsd-license.php \r | |
9 | \r | |
10 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r | |
11 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. \r | |
12 | \r | |
13 | Module Name: DxeStatusCodeCommon.c\r | |
14 | \r | |
15 | **/\r | |
16 | //\r | |
17 | // Include common header file for this module.\r | |
18 | //\r | |
19 | #include "CommonHeader.h"\r | |
20 | \r | |
21 | #include "DxeStatusCode.h"\r | |
22 | \r | |
23 | \r | |
24 | /**\r | |
25 | Report status code to all supported device. \r | |
26 | Calls into the workers which dispatches the platform specific\r | |
27 | listeners. \r | |
28 | \r | |
29 | @param Type Indicates the type of status code being reported. \r | |
30 | The type EFI_STATUS_CODE_TYPE is defined in "Related Definitions" below.\r | |
31 | @param Value Describes the current status of a hardware or software entity. \r | |
32 | This includes information about the class and subclass that is used to classify the entity \r | |
33 | as well as an operation. For progress codes, the operation is the current activity. \r | |
34 | For error codes, it is the exception. For debug codes, it is not defined at this time. \r | |
35 | Type EFI_STATUS_CODE_VALUE is defined in "Related Definitions" below. \r | |
36 | Specific values are discussed in the Intel? Platform Innovation Framework for EFI Status Code Specification.\r | |
37 | @param Instance The enumeration of a hardware or software entity within the system. \r | |
38 | A system may contain multiple entities that match a class/subclass pairing. \r | |
39 | The instance differentiates between them. An instance of 0 indicates that instance \r | |
40 | information is unavailable, not meaningful, or not relevant. Valid instance numbers start with 1.\r | |
41 | @param CallerId This optional parameter may be used to identify the caller. \r | |
42 | This parameter allows the status code driver to apply different rules to different callers.\r | |
43 | @param Data This optional parameter may be used to pass additional data. \r | |
44 | Type EFI_STATUS_CODE_DATA is defined in "Related Definitions" below. \r | |
45 | The contents of this data type may have additional GUID-specific data. The standard GUIDs and \r | |
46 | their associated data structures are defined in the Intel? Platform Innovation Framework for EFI Status Codes Specification.\r | |
47 | \r | |
48 | @return Always return EFI_SUCCESS.\r | |
49 | \r | |
50 | **/\r | |
51 | EFI_STATUS \r | |
52 | EFIAPI\r | |
53 | ReportDispatcher (\r | |
54 | IN EFI_STATUS_CODE_TYPE Type,\r | |
55 | IN EFI_STATUS_CODE_VALUE Value,\r | |
56 | IN UINT32 Instance,\r | |
57 | IN EFI_GUID *CallerId OPTIONAL,\r | |
58 | IN EFI_STATUS_CODE_DATA *Data OPTIONAL\r | |
59 | );\r | |
60 | \r | |
61 | //\r | |
62 | // Declaration of status code protocol.\r | |
63 | //\r | |
64 | STATIC\r | |
65 | EFI_STATUS_CODE_PROTOCOL mEfiStatusCodeProtocol = {\r | |
66 | ReportDispatcher\r | |
67 | };\r | |
68 | \r | |
69 | //\r | |
70 | // Delaration of DXE status code controller \r | |
71 | //\r | |
72 | DXE_STATUS_CODE_CONTROLLER gDxeStatusCode = {\r | |
73 | //\r | |
74 | // Initialize nest status as non nested. \r | |
75 | // \r | |
76 | 0,\r | |
77 | {NULL, NULL}\r | |
78 | };\r | |
79 | \r | |
80 | /**\r | |
81 | \r | |
82 | Install the ReportStatusCode runtime service.\r | |
83 | \r | |
84 | @param ImageHandle Image handle of the loaded driver\r | |
85 | @param SystemTable Pointer to the System Table\r | |
86 | \r | |
87 | @return The function always returns success.\r | |
88 | \r | |
89 | **/\r | |
90 | EFI_STATUS\r | |
91 | DxeStatusCodeDriverEntry (\r | |
92 | IN EFI_HANDLE ImageHandle,\r | |
93 | IN EFI_SYSTEM_TABLE *SystemTable\r | |
94 | )\r | |
95 | {\r | |
96 | EFI_HANDLE Handle = NULL;\r | |
97 | EFI_STATUS Status;\r | |
98 | \r | |
99 | //\r | |
100 | // Dispatch initialization request to supported devices\r | |
101 | //\r | |
102 | InitializationDispatcherWorker ();\r | |
103 | \r | |
104 | //\r | |
105 | // Install Status Code Architectural Protocol implementation as defined in Tiano\r | |
106 | // Architecture Specification.\r | |
107 | //\r | |
108 | Status = gBS->InstallMultipleProtocolInterfaces (\r | |
109 | &Handle,\r | |
110 | &gEfiStatusCodeRuntimeProtocolGuid,\r | |
111 | &mEfiStatusCodeProtocol,\r | |
112 | NULL\r | |
113 | );\r | |
114 | ASSERT_EFI_ERROR (Status);\r | |
115 | \r | |
116 | return Status;\r | |
117 | }\r | |
118 | \r | |
119 | /**\r | |
120 | Report status code to all supported device. \r | |
121 | Calls into the workers which dispatches the platform specific\r | |
122 | listeners. \r | |
123 | \r | |
124 | @param CodeType Indicates the type of status code being reported. \r | |
125 | The type EFI_STATUS_CODE_TYPE is defined in "Related Definitions" below.\r | |
126 | @param Value Describes the current status of a hardware or software entity. \r | |
127 | This includes information about the class and subclass that is used to classify the entity \r | |
128 | as well as an operation. For progress codes, the operation is the current activity. \r | |
129 | For error codes, it is the exception. For debug codes, it is not defined at this time. \r | |
130 | Type EFI_STATUS_CODE_VALUE is defined in "Related Definitions" below. \r | |
131 | Specific values are discussed in the Intel? Platform Innovation Framework for EFI Status Code Specification.\r | |
132 | @param Instance The enumeration of a hardware or software entity within the system. \r | |
133 | A system may contain multiple entities that match a class/subclass pairing. \r | |
134 | The instance differentiates between them. An instance of 0 indicates that instance \r | |
135 | information is unavailable, not meaningful, or not relevant. Valid instance numbers start with 1.\r | |
136 | @param CallerId This optional parameter may be used to identify the caller. \r | |
137 | This parameter allows the status code driver to apply different rules to different callers.\r | |
138 | @param Data This optional parameter may be used to pass additional data. \r | |
139 | Type EFI_STATUS_CODE_DATA is defined in "Related Definitions" below. \r | |
140 | The contents of this data type may have additional GUID-specific data. The standard GUIDs and \r | |
141 | their associated data structures are defined in the Intel? Platform Innovation Framework for EFI Status Codes Specification.\r | |
142 | \r | |
143 | @return Always return EFI_SUCCESS.\r | |
144 | \r | |
145 | **/\r | |
146 | EFI_STATUS \r | |
147 | EFIAPI\r | |
148 | ReportDispatcher (\r | |
149 | IN EFI_STATUS_CODE_TYPE CodeType,\r | |
150 | IN EFI_STATUS_CODE_VALUE Value,\r | |
151 | IN UINT32 Instance,\r | |
152 | IN EFI_GUID *CallerId OPTIONAL,\r | |
153 | IN EFI_STATUS_CODE_DATA *Data OPTIONAL\r | |
154 | )\r | |
155 | {\r | |
156 | //\r | |
157 | // Use atom operation to avoid the reentant of report.\r | |
158 | // If current status is not zero, then the function is reentrancy.\r | |
159 | //\r | |
160 | if (1 == InterlockedCompareExchange32 (&gDxeStatusCode.StatusCodeNestStatus, 0, 1)) {\r | |
161 | return EFI_DEVICE_ERROR;\r | |
162 | }\r | |
163 | \r | |
164 | if (FeaturePcdGet (PcdStatusCodeUseEfiSerial) || FeaturePcdGet (PcdStatusCodeUseHardSerial)) {\r | |
165 | SerialStatusCodeReportWorker (\r | |
166 | CodeType,\r | |
167 | Value,\r | |
168 | Instance,\r | |
169 | CallerId,\r | |
170 | Data\r | |
171 | );\r | |
172 | }\r | |
173 | if (FeaturePcdGet (PcdStatusCodeUseRuntimeMemory)) {\r | |
174 | RtMemoryStatusCodeReportWorker (\r | |
175 | gDxeStatusCode.RtMemoryStatusCodeTable[PHYSICAL_MODE],\r | |
176 | CodeType,\r | |
177 | Value,\r | |
178 | Instance\r | |
179 | );\r | |
180 | }\r | |
181 | if (FeaturePcdGet (PcdStatusCodeUseDataHub)) {\r | |
182 | DataHubStatusCodeReportWorker (\r | |
183 | CodeType,\r | |
184 | Value,\r | |
185 | Instance,\r | |
186 | CallerId,\r | |
187 | Data\r | |
188 | );\r | |
189 | }\r | |
190 | if (FeaturePcdGet (PcdStatusCodeUseOEM)) {\r | |
191 | OemHookStatusCodeReport (\r | |
192 | CodeType,\r | |
193 | Value,\r | |
194 | Instance,\r | |
195 | CallerId,\r | |
196 | Data\r | |
197 | );\r | |
198 | }\r | |
199 | \r | |
200 | //\r | |
201 | // Restore the nest status of report\r | |
202 | //\r | |
203 | InterlockedCompareExchange32 (&gDxeStatusCode.StatusCodeNestStatus, 1, 0);\r | |
204 | \r | |
205 | return EFI_SUCCESS;\r | |
206 | }\r | |
207 | \r | |
208 | \r | |
209 | /**\r | |
210 | Virtual address change notification call back. It converts global pointer \r | |
211 | to virtual address.\r | |
212 | \r | |
213 | @param Event Event whose notification function is being invoked.\r | |
214 | @param Context Pointer to the notification function's context, which is\r | |
215 | always zero in current implementation.\r | |
216 | \r | |
217 | **/\r | |
218 | VOID\r | |
219 | EFIAPI\r | |
220 | VirtualAddressChangeCallBack (\r | |
221 | IN EFI_EVENT Event,\r | |
222 | IN VOID *Context\r | |
223 | )\r | |
224 | {\r | |
225 | //\r | |
226 | // Convert memory status code table to virtual address;\r | |
227 | //\r | |
228 | EfiConvertPointer (\r | |
229 | 0, \r | |
230 | (VOID **) &gDxeStatusCode.RtMemoryStatusCodeTable[PHYSICAL_MODE]\r | |
231 | );\r | |
232 | }\r | |
233 | \r |