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