]>
Commit | Line | Data |
---|---|---|
c5631cef | 1 | /** @file\r |
2 | Report Status Code Library for SMM Phase.\r | |
3 | \r | |
4 | Copyright (c) 2009, Intel Corporation<BR>\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 | **/\r | |
14 | \r | |
15 | #include <Library/ReportStatusCodeLib.h>\r | |
16 | #include <Library/DebugLib.h>\r | |
17 | #include <Library/SmmServicesTableLib.h>\r | |
18 | #include <Library/BaseLib.h>\r | |
19 | #include <Library/BaseMemoryLib.h>\r | |
20 | #include <Library/PcdLib.h>\r | |
21 | \r | |
22 | #include <Guid/StatusCodeDataTypeId.h>\r | |
23 | #include <Guid/StatusCodeDataTypeDebug.h>\r | |
24 | #include <Protocol/SmmStatusCode.h>\r | |
25 | \r | |
26 | EFI_SMM_REPORT_STATUS_CODE mReportStatusCode = NULL;\r | |
27 | EFI_SMM_STATUS_CODE_PROTOCOL *mStatusCodeProtocol = NULL;\r | |
28 | \r | |
29 | \r | |
30 | /**\r | |
31 | Locate the report status code service.\r | |
32 | \r | |
33 | @return Function pointer to the report status code service.\r | |
34 | NULL is returned if no status code service is available.\r | |
35 | \r | |
36 | **/\r | |
37 | EFI_SMM_REPORT_STATUS_CODE\r | |
38 | InternalGetReportStatusCode (\r | |
39 | VOID\r | |
40 | )\r | |
41 | {\r | |
42 | EFI_STATUS Status;\r | |
43 | \r | |
44 | Status = gSmst->SmmLocateProtocol (&gEfiSmmStatusCodeProtocolGuid, NULL, (VOID**)&mStatusCodeProtocol);\r | |
45 | if (!EFI_ERROR (Status) && mStatusCodeProtocol != NULL) {\r | |
46 | return mStatusCodeProtocol->ReportStatusCode;\r | |
47 | }\r | |
48 | return NULL;\r | |
49 | }\r | |
50 | \r | |
51 | /**\r | |
52 | Internal worker function that reports a status code through the status code service.\r | |
53 | \r | |
54 | If status code service is not cached, then this function checks if status code service is\r | |
55 | available in system. If status code service is not available, then EFI_UNSUPPORTED is\r | |
56 | returned. If status code service is present, then it is cached in mReportStatusCode.\r | |
57 | Finally this function reports status code through the status code service.\r | |
58 | \r | |
59 | @param Type Status code type.\r | |
60 | @param Value Status code value.\r | |
61 | @param Instance Status code instance number.\r | |
62 | @param CallerId Pointer to a GUID that identifies the caller of this\r | |
63 | function. This is an optional parameter that may be\r | |
64 | NULL.\r | |
65 | @param Data Pointer to the extended data buffer. This is an\r | |
66 | optional parameter that may be NULL.\r | |
67 | \r | |
68 | @retval EFI_SUCCESS The status code was reported.\r | |
69 | @retval EFI_UNSUPPORTED Status code service is not available.\r | |
70 | @retval EFI_UNSUPPORTED Status code type is not supported.\r | |
71 | \r | |
72 | **/\r | |
73 | EFI_STATUS\r | |
74 | InternalReportStatusCode (\r | |
75 | IN EFI_STATUS_CODE_TYPE Type,\r | |
76 | IN EFI_STATUS_CODE_VALUE Value,\r | |
77 | IN UINT32 Instance,\r | |
78 | IN CONST EFI_GUID *CallerId OPTIONAL,\r | |
79 | IN EFI_STATUS_CODE_DATA *Data OPTIONAL\r | |
80 | )\r | |
81 | {\r | |
82 | if ((ReportProgressCodeEnabled() && ((Type) & EFI_STATUS_CODE_TYPE_MASK) == EFI_PROGRESS_CODE) ||\r | |
83 | (ReportErrorCodeEnabled() && ((Type) & EFI_STATUS_CODE_TYPE_MASK) == EFI_ERROR_CODE) ||\r | |
84 | (ReportDebugCodeEnabled() && ((Type) & EFI_STATUS_CODE_TYPE_MASK) == EFI_DEBUG_CODE)) {\r | |
85 | //\r | |
86 | // If mReportStatusCode is NULL, then check if status code service is available in system.\r | |
87 | //\r | |
88 | if (mReportStatusCode == NULL) {\r | |
89 | mReportStatusCode = InternalGetReportStatusCode ();\r | |
90 | if (mReportStatusCode == NULL) {\r | |
91 | return EFI_UNSUPPORTED;\r | |
92 | }\r | |
93 | }\r | |
94 | \r | |
95 | //\r | |
96 | // A status code service is present in system, so pass in all the parameters to the service.\r | |
97 | //\r | |
98 | return (*mReportStatusCode) (mStatusCodeProtocol, Type, Value, Instance, (EFI_GUID *)CallerId, Data);\r | |
99 | }\r | |
100 | \r | |
101 | return EFI_UNSUPPORTED;\r | |
102 | }\r | |
103 | \r | |
104 | \r | |
105 | /**\r | |
106 | Converts a status code to an 8-bit POST code value.\r | |
107 | \r | |
108 | Converts the status code specified by CodeType and Value to an 8-bit POST code\r | |
109 | and returns the 8-bit POST code in PostCode. If CodeType is an\r | |
110 | EFI_PROGRESS_CODE or CodeType is an EFI_ERROR_CODE, then bits 0..4 of PostCode\r | |
111 | are set to bits 16..20 of Value, and bits 5..7 of PostCode are set to bits\r | |
112 | 24..26 of Value., and TRUE is returned. Otherwise, FALSE is returned.\r | |
113 | \r | |
114 | If PostCode is NULL, then ASSERT().\r | |
115 | \r | |
116 | @param CodeType The type of status code being converted.\r | |
117 | @param Value The status code value being converted.\r | |
118 | @param PostCode A pointer to the 8-bit POST code value to return.\r | |
119 | \r | |
120 | @retval TRUE The status code specified by CodeType and Value was converted\r | |
121 | to an 8-bit POST code and returned in PostCode.\r | |
122 | @retval FALSE The status code specified by CodeType and Value could not be\r | |
123 | converted to an 8-bit POST code value.\r | |
124 | \r | |
125 | **/\r | |
126 | BOOLEAN\r | |
127 | EFIAPI\r | |
128 | CodeTypeToPostCode (\r | |
129 | IN EFI_STATUS_CODE_TYPE CodeType,\r | |
130 | IN EFI_STATUS_CODE_VALUE Value,\r | |
131 | OUT UINT8 *PostCode\r | |
132 | )\r | |
133 | {\r | |
134 | //\r | |
135 | // If PostCode is NULL, then ASSERT()\r | |
136 | //\r | |
137 | ASSERT (PostCode != NULL);\r | |
138 | \r | |
139 | //\r | |
140 | // Convert Value to an 8 bit post code\r | |
141 | //\r | |
142 | if (((CodeType & EFI_STATUS_CODE_TYPE_MASK) == EFI_PROGRESS_CODE) ||\r | |
143 | ((CodeType & EFI_STATUS_CODE_TYPE_MASK) == EFI_ERROR_CODE) ) {\r | |
144 | *PostCode = (UINT8) ((((Value & EFI_STATUS_CODE_CLASS_MASK) >> 24) << 5) |\r | |
145 | (((Value & EFI_STATUS_CODE_SUBCLASS_MASK) >> 16) & 0x1f));\r | |
146 | return TRUE;\r | |
147 | }\r | |
148 | return FALSE;\r | |
149 | }\r | |
150 | \r | |
151 | \r | |
152 | /**\r | |
153 | Extracts ASSERT() information from a status code structure.\r | |
154 | \r | |
155 | Converts the status code specified by CodeType, Value, and Data to the ASSERT()\r | |
156 | arguments specified by Filename, Description, and LineNumber. If CodeType is\r | |
157 | an EFI_ERROR_CODE, and CodeType has a severity of EFI_ERROR_UNRECOVERED, and\r | |
158 | Value has an operation mask of EFI_SW_EC_ILLEGAL_SOFTWARE_STATE, extract\r | |
159 | Filename, Description, and LineNumber from the optional data area of the\r | |
160 | status code buffer specified by Data. The optional data area of Data contains\r | |
161 | a Null-terminated ASCII string for the FileName, followed by a Null-terminated\r | |
162 | ASCII string for the Description, followed by a 32-bit LineNumber. If the\r | |
163 | ASSERT() information could be extracted from Data, then return TRUE.\r | |
164 | Otherwise, FALSE is returned.\r | |
165 | \r | |
166 | If Data is NULL, then ASSERT().\r | |
167 | If Filename is NULL, then ASSERT().\r | |
168 | If Description is NULL, then ASSERT().\r | |
169 | If LineNumber is NULL, then ASSERT().\r | |
170 | \r | |
171 | @param CodeType The type of status code being converted.\r | |
172 | @param Value The status code value being converted.\r | |
173 | @param Data Pointer to status code data buffer.\r | |
174 | @param Filename Pointer to the source file name that generated the ASSERT().\r | |
175 | @param Description Pointer to the description of the ASSERT().\r | |
176 | @param LineNumber Pointer to source line number that generated the ASSERT().\r | |
177 | \r | |
178 | @retval TRUE The status code specified by CodeType, Value, and Data was\r | |
179 | converted ASSERT() arguments specified by Filename, Description,\r | |
180 | and LineNumber.\r | |
181 | @retval FALSE The status code specified by CodeType, Value, and Data could\r | |
182 | not be converted to ASSERT() arguments.\r | |
183 | \r | |
184 | **/\r | |
185 | BOOLEAN\r | |
186 | EFIAPI\r | |
187 | ReportStatusCodeExtractAssertInfo (\r | |
188 | IN EFI_STATUS_CODE_TYPE CodeType,\r | |
189 | IN EFI_STATUS_CODE_VALUE Value,\r | |
190 | IN CONST EFI_STATUS_CODE_DATA *Data,\r | |
191 | OUT CHAR8 **Filename,\r | |
192 | OUT CHAR8 **Description,\r | |
193 | OUT UINT32 *LineNumber\r | |
194 | )\r | |
195 | {\r | |
196 | EFI_DEBUG_ASSERT_DATA *AssertData;\r | |
197 | \r | |
198 | ASSERT (Data != NULL);\r | |
199 | ASSERT (Filename != NULL);\r | |
200 | ASSERT (Description != NULL);\r | |
201 | ASSERT (LineNumber != NULL);\r | |
202 | \r | |
203 | if (((CodeType & EFI_STATUS_CODE_TYPE_MASK) == EFI_ERROR_CODE) &&\r | |
204 | ((CodeType & EFI_STATUS_CODE_SEVERITY_MASK) == EFI_ERROR_UNRECOVERED) &&\r | |
205 | ((Value & EFI_STATUS_CODE_OPERATION_MASK) == EFI_SW_EC_ILLEGAL_SOFTWARE_STATE)) {\r | |
206 | AssertData = (EFI_DEBUG_ASSERT_DATA *)(Data + 1);\r | |
207 | *Filename = (CHAR8 *)(AssertData + 1);\r | |
208 | *Description = *Filename + AsciiStrLen (*Filename) + 1;\r | |
209 | *LineNumber = AssertData->LineNumber;\r | |
210 | return TRUE;\r | |
211 | }\r | |
212 | return FALSE;\r | |
213 | }\r | |
214 | \r | |
215 | \r | |
216 | /**\r | |
217 | Extracts DEBUG() information from a status code structure.\r | |
218 | \r | |
219 | Converts the status code specified by Data to the DEBUG() arguments specified\r | |
220 | by ErrorLevel, Marker, and Format. If type GUID in Data is\r | |
221 | EFI_STATUS_CODE_DATA_TYPE_DEBUG_GUID, then extract ErrorLevel, Marker, and\r | |
222 | Format from the optional data area of the status code buffer specified by Data.\r | |
223 | The optional data area of Data contains a 32-bit ErrorLevel followed by Marker\r | |
224 | which is 12 UINTN parameters, followed by a Null-terminated ASCII string for\r | |
225 | the Format. If the DEBUG() information could be extracted from Data, then\r | |
226 | return TRUE. Otherwise, FALSE is returned.\r | |
227 | \r | |
228 | If Data is NULL, then ASSERT().\r | |
229 | If ErrorLevel is NULL, then ASSERT().\r | |
230 | If Marker is NULL, then ASSERT().\r | |
231 | If Format is NULL, then ASSERT().\r | |
232 | \r | |
233 | @param Data Pointer to status code data buffer.\r | |
234 | @param ErrorLevel Pointer to error level mask for a debug message.\r | |
235 | @param Marker Pointer to the variable argument list associated with Format.\r | |
236 | @param Format Pointer to a Null-terminated ASCII format string of a\r | |
237 | debug message.\r | |
238 | \r | |
239 | @retval TRUE The status code specified by Data was converted DEBUG() arguments\r | |
240 | specified by ErrorLevel, Marker, and Format.\r | |
241 | @retval FALSE The status code specified by Data could not be converted to\r | |
242 | DEBUG() arguments.\r | |
243 | \r | |
244 | **/\r | |
245 | BOOLEAN\r | |
246 | EFIAPI\r | |
247 | ReportStatusCodeExtractDebugInfo (\r | |
248 | IN CONST EFI_STATUS_CODE_DATA *Data,\r | |
249 | OUT UINT32 *ErrorLevel,\r | |
250 | OUT BASE_LIST *Marker,\r | |
251 | OUT CHAR8 **Format\r | |
252 | )\r | |
253 | {\r | |
254 | EFI_DEBUG_INFO *DebugInfo;\r | |
255 | \r | |
256 | ASSERT (Data != NULL);\r | |
257 | ASSERT (ErrorLevel != NULL);\r | |
258 | ASSERT (Marker != NULL);\r | |
259 | ASSERT (Format != NULL);\r | |
260 | \r | |
261 | //\r | |
262 | // If the GUID type is not EFI_STATUS_CODE_DATA_TYPE_DEBUG_GUID then return FALSE\r | |
263 | //\r | |
264 | if (!CompareGuid (&Data->Type, &gEfiStatusCodeDataTypeDebugGuid)) {\r | |
265 | return FALSE;\r | |
266 | }\r | |
267 | \r | |
268 | //\r | |
269 | // Retrieve the debug information from the status code record\r | |
270 | //\r | |
271 | DebugInfo = (EFI_DEBUG_INFO *)(Data + 1);\r | |
272 | \r | |
273 | *ErrorLevel = DebugInfo->ErrorLevel;\r | |
274 | \r | |
275 | //\r | |
276 | // The first 12 * sizeof (UINT64) bytes following EFI_DEBUG_INFO are for variable arguments\r | |
277 | // of format in DEBUG string. Its address is returned in Marker and has to be 64-bit aligned.\r | |
278 | // It must be noticed that EFI_DEBUG_INFO follows EFI_STATUS_CODE_DATA, whose size is\r | |
279 | // 20 bytes. The size of EFI_DEBUG_INFO is 4 bytes, so we can ensure that Marker\r | |
280 | // returned is 64-bit aligned.\r | |
281 | // 64-bit aligned is a must, otherwise retrieving 64-bit parameter from BASE_LIST will\r | |
282 | // cause unalignment exception.\r | |
283 | //\r | |
284 | *Marker = (BASE_LIST) (DebugInfo + 1);\r | |
285 | *Format = (CHAR8 *)(((UINT64 *)*Marker) + 12);\r | |
286 | \r | |
287 | return TRUE;\r | |
288 | }\r | |
289 | \r | |
290 | \r | |
291 | /**\r | |
292 | Reports a status code.\r | |
293 | \r | |
294 | Reports the status code specified by the parameters Type and Value. Status\r | |
295 | code also require an instance, caller ID, and extended data. This function\r | |
296 | passed in a zero instance, NULL extended data, and a caller ID of\r | |
297 | gEfiCallerIdGuid, which is the GUID for the module.\r | |
298 | \r | |
299 | ReportStatusCode()must actively prevent recusrsion. If ReportStatusCode()\r | |
300 | is called while processing another any other Report Status Code Library function,\r | |
301 | then ReportStatusCode() must return immediately.\r | |
302 | \r | |
303 | @param Type Status code type.\r | |
304 | @param Value Status code value.\r | |
305 | \r | |
306 | @retval EFI_SUCCESS The status code was reported.\r | |
307 | @retval EFI_DEVICE_ERROR There status code could not be reported due to a\r | |
308 | device error.\r | |
309 | @retval EFI_UNSUPPORTED Report status code is not supported\r | |
310 | \r | |
311 | **/\r | |
312 | EFI_STATUS\r | |
313 | EFIAPI\r | |
314 | ReportStatusCode (\r | |
315 | IN EFI_STATUS_CODE_TYPE Type,\r | |
316 | IN EFI_STATUS_CODE_VALUE Value\r | |
317 | )\r | |
318 | {\r | |
319 | return InternalReportStatusCode (Type, Value, 0, &gEfiCallerIdGuid, NULL);\r | |
320 | }\r | |
321 | \r | |
322 | \r | |
323 | /**\r | |
324 | Reports a status code with an extended data buffer.\r | |
325 | \r | |
326 | Allocates and fills in the extended data section of a status code with the\r | |
327 | extended data specified by ExtendedData and ExtendedDataSize. ExtendedData\r | |
328 | is assumed to be one of the data structures specified in Related Definitions.\r | |
329 | These data structure do not have the standard header, so this function is\r | |
330 | responsible for allocating a buffer large enough for the standard header and\r | |
331 | the extended data passed into this function. The standard header is filled\r | |
332 | in with a GUID of gEfiStatusCodeSpecificDataGuid. The status code is reported\r | |
333 | with a zero instance and a caller ID of gEfiCallerIdGuid.\r | |
334 | \r | |
335 | ReportStatusCodeWithExtendedData()must actively prevent recursion. If\r | |
336 | ReportStatusCodeWithExtendedData() is called while processing another any other\r | |
337 | Report Status Code Library function, then ReportStatusCodeWithExtendedData()\r | |
338 | must return EFI_DEVICE_ERROR immediately.\r | |
339 | \r | |
340 | If ExtendedData is NULL, then ASSERT().\r | |
341 | If ExtendedDataSize is 0, then ASSERT().\r | |
342 | \r | |
343 | @param Type Status code type.\r | |
344 | @param Value Status code value.\r | |
345 | @param ExtendedData Pointer to the extended data buffer to be reported.\r | |
346 | @param ExtendedDataSize The size, in bytes, of the extended data buffer to\r | |
347 | be reported.\r | |
348 | \r | |
349 | @retval EFI_SUCCESS The status code was reported with the extended\r | |
350 | data specified by ExtendedData and ExtendedDataSize.\r | |
351 | @retval EFI_OUT_OF_RESOURCES There were not enough resources to allocate the\r | |
352 | extended data section.\r | |
353 | @retval EFI_UNSUPPORTED Report status code is not supported\r | |
354 | \r | |
355 | **/\r | |
356 | EFI_STATUS\r | |
357 | EFIAPI\r | |
358 | ReportStatusCodeWithExtendedData (\r | |
359 | IN EFI_STATUS_CODE_TYPE Type,\r | |
360 | IN EFI_STATUS_CODE_VALUE Value,\r | |
361 | IN CONST VOID *ExtendedData,\r | |
362 | IN UINTN ExtendedDataSize\r | |
363 | )\r | |
364 | {\r | |
365 | ASSERT (ExtendedData != NULL);\r | |
366 | ASSERT (ExtendedDataSize != 0);\r | |
367 | return ReportStatusCodeEx (\r | |
368 | Type,\r | |
369 | Value,\r | |
370 | 0,\r | |
371 | NULL,\r | |
372 | NULL,\r | |
373 | ExtendedData,\r | |
374 | ExtendedDataSize\r | |
375 | );\r | |
376 | }\r | |
377 | \r | |
378 | \r | |
379 | /**\r | |
380 | Reports a status code with full parameters.\r | |
381 | \r | |
382 | The function reports a status code. If ExtendedData is NULL and ExtendedDataSize\r | |
383 | is 0, then an extended data buffer is not reported. If ExtendedData is not\r | |
384 | NULL and ExtendedDataSize is not 0, then an extended data buffer is allocated.\r | |
385 | ExtendedData is assumed not have the standard status code header, so this function\r | |
386 | is responsible for allocating a buffer large enough for the standard header and\r | |
387 | the extended data passed into this function. The standard header is filled in\r | |
388 | with a GUID specified by ExtendedDataGuid. If ExtendedDataGuid is NULL, then a\r | |
389 | GUID of gEfiStatusCodeSpecificDataGuid is used. The status code is reported with\r | |
390 | an instance specified by Instance and a caller ID specified by CallerId. If\r | |
391 | CallerId is NULL, then a caller ID of gEfiCallerIdGuid is used.\r | |
392 | \r | |
393 | ReportStatusCodeEx()must actively prevent recursion. If\r | |
394 | ReportStatusCodeEx() is called while processing another any\r | |
395 | other Report Status Code Library function, then\r | |
396 | ReportStatusCodeEx() must return EFI_DEVICE_ERROR immediately.\r | |
397 | \r | |
398 | If ExtendedData is NULL and ExtendedDataSize is not zero, then ASSERT().\r | |
399 | If ExtendedData is not NULL and ExtendedDataSize is zero, then ASSERT().\r | |
400 | \r | |
401 | @param Type Status code type.\r | |
402 | @param Value Status code value.\r | |
403 | @param Instance Status code instance number.\r | |
404 | @param CallerId Pointer to a GUID that identifies the caller of this\r | |
405 | function. If this parameter is NULL, then a caller\r | |
406 | ID of gEfiCallerIdGuid is used.\r | |
407 | @param ExtendedDataGuid Pointer to the GUID for the extended data buffer.\r | |
408 | If this parameter is NULL, then a the status code\r | |
409 | standard header is filled in with\r | |
410 | gEfiStatusCodeSpecificDataGuid.\r | |
411 | @param ExtendedData Pointer to the extended data buffer. This is an\r | |
412 | optional parameter that may be NULL.\r | |
413 | @param ExtendedDataSize The size, in bytes, of the extended data buffer.\r | |
414 | \r | |
415 | @retval EFI_SUCCESS The status code was reported.\r | |
416 | @retval EFI_OUT_OF_RESOURCES There were not enough resources to allocate\r | |
417 | the extended data section if it was specified.\r | |
418 | @retval EFI_UNSUPPORTED Report status code is not supported\r | |
419 | \r | |
420 | **/\r | |
421 | EFI_STATUS\r | |
422 | EFIAPI\r | |
423 | ReportStatusCodeEx (\r | |
424 | IN EFI_STATUS_CODE_TYPE Type,\r | |
425 | IN EFI_STATUS_CODE_VALUE Value,\r | |
426 | IN UINT32 Instance,\r | |
427 | IN CONST EFI_GUID *CallerId OPTIONAL,\r | |
428 | IN CONST EFI_GUID *ExtendedDataGuid OPTIONAL,\r | |
429 | IN CONST VOID *ExtendedData OPTIONAL,\r | |
430 | IN UINTN ExtendedDataSize\r | |
431 | )\r | |
432 | {\r | |
433 | EFI_STATUS Status;\r | |
434 | EFI_STATUS_CODE_DATA *StatusCodeData;\r | |
435 | \r | |
436 | ASSERT (!((ExtendedData == NULL) && (ExtendedDataSize != 0)));\r | |
437 | ASSERT (!((ExtendedData != NULL) && (ExtendedDataSize == 0)));\r | |
438 | \r | |
439 | if (gSmst == NULL || gSmst->SmmAllocatePool == NULL || gSmst->SmmFreePool == NULL) {\r | |
440 | return EFI_UNSUPPORTED;\r | |
441 | }\r | |
442 | \r | |
443 | //\r | |
444 | // Allocate space for the Status Code Header and its buffer\r | |
445 | //\r | |
446 | StatusCodeData = NULL;\r | |
447 | gSmst->SmmAllocatePool (EfiRuntimeServicesData, sizeof (EFI_STATUS_CODE_DATA) + ExtendedDataSize, (VOID **)&StatusCodeData);\r | |
448 | if (StatusCodeData == NULL) {\r | |
449 | return EFI_OUT_OF_RESOURCES;\r | |
450 | }\r | |
451 | \r | |
452 | //\r | |
453 | // Fill in the extended data header\r | |
454 | //\r | |
455 | StatusCodeData->HeaderSize = sizeof (EFI_STATUS_CODE_DATA);\r | |
456 | StatusCodeData->Size = (UINT16)ExtendedDataSize;\r | |
457 | if (ExtendedDataGuid == NULL) {\r | |
458 | ExtendedDataGuid = &gEfiStatusCodeSpecificDataGuid;\r | |
459 | }\r | |
460 | CopyGuid (&StatusCodeData->Type, ExtendedDataGuid);\r | |
461 | \r | |
462 | //\r | |
463 | // Fill in the extended data buffer\r | |
464 | //\r | |
465 | if (ExtendedData != NULL) {\r | |
466 | CopyMem (StatusCodeData + 1, ExtendedData, ExtendedDataSize);\r | |
467 | }\r | |
468 | \r | |
469 | //\r | |
470 | // Report the status code\r | |
471 | //\r | |
472 | if (CallerId == NULL) {\r | |
473 | CallerId = &gEfiCallerIdGuid;\r | |
474 | }\r | |
475 | Status = InternalReportStatusCode (Type, Value, Instance, CallerId, StatusCodeData);\r | |
476 | \r | |
477 | //\r | |
478 | // Free the allocated buffer\r | |
479 | //\r | |
480 | gSmst->SmmFreePool (StatusCodeData);\r | |
481 | \r | |
482 | return Status;\r | |
483 | }\r | |
484 | \r | |
485 | \r | |
486 | /**\r | |
487 | Returns TRUE if status codes of type EFI_PROGRESS_CODE are enabled\r | |
488 | \r | |
489 | This function returns TRUE if the REPORT_STATUS_CODE_PROPERTY_PROGRESS_CODE_ENABLED\r | |
490 | bit of PcdReportStatusCodeProperyMask is set. Otherwise FALSE is returned.\r | |
491 | \r | |
492 | @retval TRUE The REPORT_STATUS_CODE_PROPERTY_PROGRESS_CODE_ENABLED bit of\r | |
493 | PcdReportStatusCodeProperyMask is set.\r | |
494 | @retval FALSE The REPORT_STATUS_CODE_PROPERTY_PROGRESS_CODE_ENABLED bit of\r | |
495 | PcdReportStatusCodeProperyMask is clear.\r | |
496 | \r | |
497 | **/\r | |
498 | BOOLEAN\r | |
499 | EFIAPI\r | |
500 | ReportProgressCodeEnabled (\r | |
501 | VOID\r | |
502 | )\r | |
503 | {\r | |
504 | return (BOOLEAN) ((PcdGet8 (PcdReportStatusCodePropertyMask) & REPORT_STATUS_CODE_PROPERTY_PROGRESS_CODE_ENABLED) != 0);\r | |
505 | }\r | |
506 | \r | |
507 | \r | |
508 | /**\r | |
509 | Returns TRUE if status codes of type EFI_ERROR_CODE are enabled\r | |
510 | \r | |
511 | This function returns TRUE if the REPORT_STATUS_CODE_PROPERTY_ERROR_CODE_ENABLED\r | |
512 | bit of PcdReportStatusCodeProperyMask is set. Otherwise FALSE is returned.\r | |
513 | \r | |
514 | @retval TRUE The REPORT_STATUS_CODE_PROPERTY_ERROR_CODE_ENABLED bit of\r | |
515 | PcdReportStatusCodeProperyMask is set.\r | |
516 | @retval FALSE The REPORT_STATUS_CODE_PROPERTY_ERROR_CODE_ENABLED bit of\r | |
517 | PcdReportStatusCodeProperyMask is clear.\r | |
518 | \r | |
519 | **/\r | |
520 | BOOLEAN\r | |
521 | EFIAPI\r | |
522 | ReportErrorCodeEnabled (\r | |
523 | VOID\r | |
524 | )\r | |
525 | {\r | |
526 | return (BOOLEAN) ((PcdGet8 (PcdReportStatusCodePropertyMask) & REPORT_STATUS_CODE_PROPERTY_ERROR_CODE_ENABLED) != 0);\r | |
527 | }\r | |
528 | \r | |
529 | \r | |
530 | /**\r | |
531 | Returns TRUE if status codes of type EFI_DEBUG_CODE are enabled\r | |
532 | \r | |
533 | This function returns TRUE if the REPORT_STATUS_CODE_PROPERTY_DEBUG_CODE_ENABLED\r | |
534 | bit of PcdReportStatusCodeProperyMask is set. Otherwise FALSE is returned.\r | |
535 | \r | |
536 | @retval TRUE The REPORT_STATUS_CODE_PROPERTY_DEBUG_CODE_ENABLED bit of\r | |
537 | PcdReportStatusCodeProperyMask is set.\r | |
538 | @retval FALSE The REPORT_STATUS_CODE_PROPERTY_DEBUG_CODE_ENABLED bit of\r | |
539 | PcdReportStatusCodeProperyMask is clear.\r | |
540 | \r | |
541 | **/\r | |
542 | BOOLEAN\r | |
543 | EFIAPI\r | |
544 | ReportDebugCodeEnabled (\r | |
545 | VOID\r | |
546 | )\r | |
547 | {\r | |
548 | return (BOOLEAN) ((PcdGet8 (PcdReportStatusCodePropertyMask) & REPORT_STATUS_CODE_PROPERTY_DEBUG_CODE_ENABLED) != 0);\r | |
549 | }\r |