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