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