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