]> git.proxmox.com Git - mirror_edk2.git/blame_incremental - MdeModulePkg/Library/PeiDxeDebugLibReportStatusCode/DebugLib.c
UefiCpuPkg: Move AsmRelocateApLoopStart from Mpfuncs.nasm to AmdSev.nasm
[mirror_edk2.git] / MdeModulePkg / Library / PeiDxeDebugLibReportStatusCode / DebugLib.c
... / ...
CommitLineData
1/** @file\r
2 Debug Library based on report status code library.\r
3\r
4 Note that if the debug message length is larger than the maximum allowable\r
5 record length, then the debug message will be ignored directly.\r
6\r
7 Copyright (c) 2006 - 2019, Intel Corporation. All rights reserved.<BR>\r
8 SPDX-License-Identifier: BSD-2-Clause-Patent\r
9\r
10**/\r
11\r
12#include <PiPei.h>\r
13\r
14#include <Guid/StatusCodeDataTypeId.h>\r
15#include <Guid/StatusCodeDataTypeDebug.h>\r
16\r
17#include <Library/DebugLib.h>\r
18#include <Library/BaseLib.h>\r
19#include <Library/BaseMemoryLib.h>\r
20#include <Library/ReportStatusCodeLib.h>\r
21#include <Library/PcdLib.h>\r
22#include <Library/DebugPrintErrorLevelLib.h>\r
23\r
24//\r
25// VA_LIST can not initialize to NULL for all compiler, so we use this to\r
26// indicate a null VA_LIST\r
27//\r
28VA_LIST mVaListNull;\r
29\r
30/**\r
31 Prints a debug message to the debug output device if the specified error level is enabled.\r
32\r
33 If any bit in ErrorLevel is also set in DebugPrintErrorLevelLib function\r
34 GetDebugPrintErrorLevel (), then print the message specified by Format and the\r
35 associated variable argument list to the debug output device.\r
36\r
37 If Format is NULL, then ASSERT().\r
38\r
39 If the length of the message string specificed by Format is larger than the maximum allowable\r
40 record length, then directly return and not print it.\r
41\r
42 @param ErrorLevel The error level of the debug message.\r
43 @param Format Format string for the debug message to print.\r
44 @param ... Variable argument list whose contents are accessed\r
45 based on the format string specified by Format.\r
46\r
47**/\r
48VOID\r
49EFIAPI\r
50DebugPrint (\r
51 IN UINTN ErrorLevel,\r
52 IN CONST CHAR8 *Format,\r
53 ...\r
54 )\r
55{\r
56 VA_LIST Marker;\r
57\r
58 VA_START (Marker, Format);\r
59 DebugVPrint (ErrorLevel, Format, Marker);\r
60 VA_END (Marker);\r
61}\r
62\r
63/**\r
64 Prints a debug message to the debug output device if the specified\r
65 error level is enabled base on Null-terminated format string and a\r
66 VA_LIST argument list or a BASE_LIST argument list.\r
67\r
68 If any bit in ErrorLevel is also set in DebugPrintErrorLevelLib function\r
69 GetDebugPrintErrorLevel (), then print the message specified by Format and\r
70 the associated variable argument list to the debug output device.\r
71\r
72 Only one list type is used.\r
73 If BaseListMarker == NULL, then use VaListMarker.\r
74 Otherwise use BaseListMarker and the VaListMarker should be initilized as\r
75 mVaListNull.\r
76\r
77 If Format is NULL, then ASSERT().\r
78\r
79 @param ErrorLevel The error level of the debug message.\r
80 @param Format Format string for the debug message to print.\r
81 @param VaListMarker VA_LIST marker for the variable argument list.\r
82 @param BaseListMarker BASE_LIST marker for the variable argument list.\r
83\r
84**/\r
85VOID\r
86DebugPrintMarker (\r
87 IN UINTN ErrorLevel,\r
88 IN CONST CHAR8 *Format,\r
89 IN VA_LIST VaListMarker,\r
90 IN BASE_LIST BaseListMarker\r
91 )\r
92{\r
93 UINT64 Buffer[(EFI_STATUS_CODE_DATA_MAX_SIZE / sizeof (UINT64)) + 1];\r
94 EFI_DEBUG_INFO *DebugInfo;\r
95 UINTN TotalSize;\r
96 BASE_LIST BaseListMarkerPointer;\r
97 CHAR8 *FormatString;\r
98 BOOLEAN Long;\r
99\r
100 //\r
101 // If Format is NULL, then ASSERT().\r
102 //\r
103 ASSERT (Format != NULL);\r
104\r
105 //\r
106 // Check driver Debug Level value and global debug level\r
107 //\r
108 if ((ErrorLevel & GetDebugPrintErrorLevel ()) == 0) {\r
109 return;\r
110 }\r
111\r
112 //\r
113 // Compute the total size of the record.\r
114 // Note that the passing-in format string and variable parameters will be constructed to\r
115 // the following layout:\r
116 //\r
117 // Buffer->|------------------------|\r
118 // | Padding | 4 bytes\r
119 // DebugInfo->|------------------------|\r
120 // | EFI_DEBUG_INFO | sizeof(EFI_DEBUG_INFO)\r
121 // BaseListMarkerPointer->|------------------------|\r
122 // | ... |\r
123 // | variable arguments | 12 * sizeof (UINT64)\r
124 // | ... |\r
125 // |------------------------|\r
126 // | Format String |\r
127 // |------------------------|<- (UINT8 *)Buffer + sizeof(Buffer)\r
128 //\r
129 TotalSize = 4 + sizeof (EFI_DEBUG_INFO) + 12 * sizeof (UINT64) + AsciiStrSize (Format);\r
130\r
131 //\r
132 // If the TotalSize is larger than the maximum record size, then truncate it.\r
133 //\r
134 if (TotalSize > sizeof (Buffer)) {\r
135 TotalSize = sizeof (Buffer);\r
136 }\r
137\r
138 //\r
139 // Fill in EFI_DEBUG_INFO\r
140 //\r
141 // Here we skip the first 4 bytes of Buffer, because we must ensure BaseListMarkerPointer is\r
142 // 64-bit aligned, otherwise retrieving 64-bit parameter from BaseListMarkerPointer will cause\r
143 // exception on IPF. Buffer starts at 64-bit aligned address, so skipping 4 types (sizeof(EFI_DEBUG_INFO))\r
144 // just makes address of BaseListMarkerPointer, which follows DebugInfo, 64-bit aligned.\r
145 //\r
146 DebugInfo = (EFI_DEBUG_INFO *)(Buffer) + 1;\r
147 DebugInfo->ErrorLevel = (UINT32)ErrorLevel;\r
148 BaseListMarkerPointer = (BASE_LIST)(DebugInfo + 1);\r
149 FormatString = (CHAR8 *)((UINT64 *)(DebugInfo + 1) + 12);\r
150\r
151 //\r
152 // Copy the Format string into the record. It will be truncated if it's too long.\r
153 //\r
154 AsciiStrnCpyS (\r
155 FormatString,\r
156 sizeof (Buffer) - (4 + sizeof (EFI_DEBUG_INFO) + 12 * sizeof (UINT64)),\r
157 Format,\r
158 sizeof (Buffer) - (4 + sizeof (EFI_DEBUG_INFO) + 12 * sizeof (UINT64)) - 1\r
159 );\r
160\r
161 //\r
162 // The first 12 * sizeof (UINT64) bytes following EFI_DEBUG_INFO are for variable arguments\r
163 // of format in DEBUG string, which is followed by the DEBUG format string.\r
164 // Here we will process the variable arguments and pack them in this area.\r
165 //\r
166\r
167 //\r
168 // Use the actual format string.\r
169 //\r
170 Format = FormatString;\r
171 for ( ; *Format != '\0'; Format++) {\r
172 //\r
173 // Only format with prefix % is processed.\r
174 //\r
175 if (*Format != '%') {\r
176 continue;\r
177 }\r
178\r
179 Long = FALSE;\r
180 //\r
181 // Parse Flags and Width\r
182 //\r
183 for (Format++; TRUE; Format++) {\r
184 if ((*Format == '.') || (*Format == '-') || (*Format == '+') || (*Format == ' ')) {\r
185 //\r
186 // These characters in format field are omitted.\r
187 //\r
188 continue;\r
189 }\r
190\r
191 if ((*Format >= '0') && (*Format <= '9')) {\r
192 //\r
193 // These characters in format field are omitted.\r
194 //\r
195 continue;\r
196 }\r
197\r
198 if ((*Format == 'L') || (*Format == 'l')) {\r
199 //\r
200 // 'L" or "l" in format field means the number being printed is a UINT64\r
201 //\r
202 Long = TRUE;\r
203 continue;\r
204 }\r
205\r
206 if (*Format == '*') {\r
207 //\r
208 // '*' in format field means the precision of the field is specified by\r
209 // a UINTN argument in the argument list.\r
210 //\r
211 if (BaseListMarker == NULL) {\r
212 BASE_ARG (BaseListMarkerPointer, UINTN) = VA_ARG (VaListMarker, UINTN);\r
213 } else {\r
214 BASE_ARG (BaseListMarkerPointer, UINTN) = BASE_ARG (BaseListMarker, UINTN);\r
215 }\r
216\r
217 continue;\r
218 }\r
219\r
220 if (*Format == '\0') {\r
221 //\r
222 // Make no output if Format string terminates unexpectedly when\r
223 // looking up for flag, width, precision and type.\r
224 //\r
225 Format--;\r
226 }\r
227\r
228 //\r
229 // When valid argument type detected or format string terminates unexpectedly,\r
230 // the inner loop is done.\r
231 //\r
232 break;\r
233 }\r
234\r
235 //\r
236 // Pack variable arguments into the storage area following EFI_DEBUG_INFO.\r
237 //\r
238 if ((*Format == 'p') && (sizeof (VOID *) > 4)) {\r
239 Long = TRUE;\r
240 }\r
241\r
242 if ((*Format == 'p') || (*Format == 'X') || (*Format == 'x') || (*Format == 'd') || (*Format == 'u')) {\r
243 if (Long) {\r
244 if (BaseListMarker == NULL) {\r
245 BASE_ARG (BaseListMarkerPointer, INT64) = VA_ARG (VaListMarker, INT64);\r
246 } else {\r
247 BASE_ARG (BaseListMarkerPointer, INT64) = BASE_ARG (BaseListMarker, INT64);\r
248 }\r
249 } else {\r
250 if (BaseListMarker == NULL) {\r
251 BASE_ARG (BaseListMarkerPointer, int) = VA_ARG (VaListMarker, int);\r
252 } else {\r
253 BASE_ARG (BaseListMarkerPointer, int) = BASE_ARG (BaseListMarker, int);\r
254 }\r
255 }\r
256 } else if ((*Format == 's') || (*Format == 'S') || (*Format == 'a') || (*Format == 'g') || (*Format == 't')) {\r
257 if (BaseListMarker == NULL) {\r
258 BASE_ARG (BaseListMarkerPointer, VOID *) = VA_ARG (VaListMarker, VOID *);\r
259 } else {\r
260 BASE_ARG (BaseListMarkerPointer, VOID *) = BASE_ARG (BaseListMarker, VOID *);\r
261 }\r
262 } else if (*Format == 'c') {\r
263 if (BaseListMarker == NULL) {\r
264 BASE_ARG (BaseListMarkerPointer, UINTN) = VA_ARG (VaListMarker, UINTN);\r
265 } else {\r
266 BASE_ARG (BaseListMarkerPointer, UINTN) = BASE_ARG (BaseListMarker, UINTN);\r
267 }\r
268 } else if (*Format == 'r') {\r
269 if (BaseListMarker == NULL) {\r
270 BASE_ARG (BaseListMarkerPointer, RETURN_STATUS) = VA_ARG (VaListMarker, RETURN_STATUS);\r
271 } else {\r
272 BASE_ARG (BaseListMarkerPointer, RETURN_STATUS) = BASE_ARG (BaseListMarker, RETURN_STATUS);\r
273 }\r
274 }\r
275\r
276 //\r
277 // If the converted BASE_LIST is larger than the 12 * sizeof (UINT64) allocated bytes, then ASSERT()\r
278 // This indicates that the DEBUG() macro is passing in more argument than can be handled by\r
279 // the EFI_DEBUG_INFO record\r
280 //\r
281 ASSERT ((CHAR8 *)BaseListMarkerPointer <= FormatString);\r
282\r
283 //\r
284 // If the converted BASE_LIST is larger than the 12 * sizeof (UINT64) allocated bytes, then return\r
285 //\r
286 if ((CHAR8 *)BaseListMarkerPointer > FormatString) {\r
287 return;\r
288 }\r
289 }\r
290\r
291 //\r
292 // Send the DebugInfo record\r
293 //\r
294 REPORT_STATUS_CODE_EX (\r
295 EFI_DEBUG_CODE,\r
296 (EFI_SOFTWARE_DXE_BS_DRIVER | EFI_DC_UNSPECIFIED),\r
297 0,\r
298 NULL,\r
299 &gEfiStatusCodeDataTypeDebugGuid,\r
300 DebugInfo,\r
301 TotalSize\r
302 );\r
303}\r
304\r
305/**\r
306 Prints a debug message to the debug output device if the specified\r
307 error level is enabled.\r
308\r
309 If any bit in ErrorLevel is also set in DebugPrintErrorLevelLib function\r
310 GetDebugPrintErrorLevel (), then print the message specified by Format and\r
311 the associated variable argument list to the debug output device.\r
312\r
313 If Format is NULL, then ASSERT().\r
314\r
315 @param ErrorLevel The error level of the debug message.\r
316 @param Format Format string for the debug message to print.\r
317 @param VaListMarker VA_LIST marker for the variable argument list.\r
318\r
319**/\r
320VOID\r
321EFIAPI\r
322DebugVPrint (\r
323 IN UINTN ErrorLevel,\r
324 IN CONST CHAR8 *Format,\r
325 IN VA_LIST VaListMarker\r
326 )\r
327{\r
328 DebugPrintMarker (ErrorLevel, Format, VaListMarker, NULL);\r
329}\r
330\r
331/**\r
332 Prints a debug message to the debug output device if the specified\r
333 error level is enabled.\r
334 This function use BASE_LIST which would provide a more compatible\r
335 service than VA_LIST.\r
336\r
337 If any bit in ErrorLevel is also set in DebugPrintErrorLevelLib function\r
338 GetDebugPrintErrorLevel (), then print the message specified by Format and\r
339 the associated variable argument list to the debug output device.\r
340\r
341 If Format is NULL, then ASSERT().\r
342\r
343 @param ErrorLevel The error level of the debug message.\r
344 @param Format Format string for the debug message to print.\r
345 @param BaseListMarker BASE_LIST marker for the variable argument list.\r
346\r
347**/\r
348VOID\r
349EFIAPI\r
350DebugBPrint (\r
351 IN UINTN ErrorLevel,\r
352 IN CONST CHAR8 *Format,\r
353 IN BASE_LIST BaseListMarker\r
354 )\r
355{\r
356 DebugPrintMarker (ErrorLevel, Format, mVaListNull, BaseListMarker);\r
357}\r
358\r
359/**\r
360 Prints an assert message containing a filename, line number, and description.\r
361 This may be followed by a breakpoint or a dead loop.\r
362\r
363 Print a message of the form "ASSERT <FileName>(<LineNumber>): <Description>\n"\r
364 to the debug output device. If DEBUG_PROPERTY_ASSERT_BREAKPOINT_ENABLED bit of\r
365 PcdDebugProperyMask is set then CpuBreakpoint() is called. Otherwise, if\r
366 DEBUG_PROPERTY_ASSERT_DEADLOOP_ENABLED bit of PcdDebugProperyMask is set then\r
367 CpuDeadLoop() is called. If neither of these bits are set, then this function\r
368 returns immediately after the message is printed to the debug output device.\r
369 DebugAssert() must actively prevent recursion. If DebugAssert() is called while\r
370 processing another DebugAssert(), then DebugAssert() must return immediately.\r
371\r
372 If FileName is NULL, then a <FileName> string of "(NULL) Filename" is printed.\r
373 If Description is NULL, then a <Description> string of "(NULL) Description" is printed.\r
374\r
375 @param FileName Pointer to the name of the source file that generated the assert condition.\r
376 @param LineNumber The line number in the source file that generated the assert condition\r
377 @param Description Pointer to the description of the assert condition.\r
378\r
379**/\r
380VOID\r
381EFIAPI\r
382DebugAssert (\r
383 IN CONST CHAR8 *FileName,\r
384 IN UINTN LineNumber,\r
385 IN CONST CHAR8 *Description\r
386 )\r
387{\r
388 UINT64 Buffer[EFI_STATUS_CODE_DATA_MAX_SIZE / sizeof (UINT64)];\r
389 EFI_DEBUG_ASSERT_DATA *AssertData;\r
390 UINTN HeaderSize;\r
391 UINTN TotalSize;\r
392 CHAR8 *Temp;\r
393 UINTN ModuleNameSize;\r
394 UINTN FileNameSize;\r
395 UINTN DescriptionSize;\r
396\r
397 //\r
398 // Get string size\r
399 //\r
400 HeaderSize = sizeof (EFI_DEBUG_ASSERT_DATA);\r
401 //\r
402 // Compute string size of module name enclosed by []\r
403 //\r
404 ModuleNameSize = 2 + AsciiStrSize (gEfiCallerBaseName);\r
405 FileNameSize = AsciiStrSize (FileName);\r
406 DescriptionSize = AsciiStrSize (Description);\r
407\r
408 //\r
409 // Make sure it will all fit in the passed in buffer.\r
410 //\r
411 if (HeaderSize + ModuleNameSize + FileNameSize + DescriptionSize > sizeof (Buffer)) {\r
412 //\r
413 // remove module name if it's too long to be filled into buffer\r
414 //\r
415 ModuleNameSize = 0;\r
416 if (HeaderSize + FileNameSize + DescriptionSize > sizeof (Buffer)) {\r
417 //\r
418 // FileName + Description is too long to be filled into buffer.\r
419 //\r
420 if (HeaderSize + FileNameSize < sizeof (Buffer)) {\r
421 //\r
422 // Description has enough buffer to be truncated.\r
423 //\r
424 DescriptionSize = sizeof (Buffer) - HeaderSize - FileNameSize;\r
425 } else {\r
426 //\r
427 // FileName is too long to be filled into buffer.\r
428 // FileName will be truncated. Reserved one byte for Description NULL terminator.\r
429 //\r
430 DescriptionSize = 1;\r
431 FileNameSize = sizeof (Buffer) - HeaderSize - DescriptionSize;\r
432 }\r
433 }\r
434 }\r
435\r
436 //\r
437 // Fill in EFI_DEBUG_ASSERT_DATA\r
438 //\r
439 AssertData = (EFI_DEBUG_ASSERT_DATA *)Buffer;\r
440 AssertData->LineNumber = (UINT32)LineNumber;\r
441 TotalSize = sizeof (EFI_DEBUG_ASSERT_DATA);\r
442\r
443 Temp = (CHAR8 *)(AssertData + 1);\r
444\r
445 //\r
446 // Copy Ascii [ModuleName].\r
447 //\r
448 if (ModuleNameSize != 0) {\r
449 CopyMem (Temp, "[", 1);\r
450 CopyMem (Temp + 1, gEfiCallerBaseName, ModuleNameSize - 3);\r
451 CopyMem (Temp + ModuleNameSize - 2, "] ", 2);\r
452 }\r
453\r
454 //\r
455 // Copy Ascii FileName including NULL terminator.\r
456 //\r
457 Temp = CopyMem (Temp + ModuleNameSize, FileName, FileNameSize);\r
458 Temp[FileNameSize - 1] = 0;\r
459 TotalSize += (ModuleNameSize + FileNameSize);\r
460\r
461 //\r
462 // Copy Ascii Description include NULL terminator.\r
463 //\r
464 Temp = CopyMem (Temp + FileNameSize, Description, DescriptionSize);\r
465 Temp[DescriptionSize - 1] = 0;\r
466 TotalSize += DescriptionSize;\r
467\r
468 REPORT_STATUS_CODE_EX (\r
469 (EFI_ERROR_CODE | EFI_ERROR_UNRECOVERED),\r
470 (EFI_SOFTWARE_DXE_BS_DRIVER | EFI_SW_EC_ILLEGAL_SOFTWARE_STATE),\r
471 0,\r
472 NULL,\r
473 NULL,\r
474 AssertData,\r
475 TotalSize\r
476 );\r
477\r
478 //\r
479 // Generate a Breakpoint, DeadLoop, or NOP based on PCD settings\r
480 //\r
481 if ((PcdGet8 (PcdDebugPropertyMask) & DEBUG_PROPERTY_ASSERT_BREAKPOINT_ENABLED) != 0) {\r
482 CpuBreakpoint ();\r
483 } else if ((PcdGet8 (PcdDebugPropertyMask) & DEBUG_PROPERTY_ASSERT_DEADLOOP_ENABLED) != 0) {\r
484 CpuDeadLoop ();\r
485 }\r
486}\r
487\r
488/**\r
489 Fills a target buffer with PcdDebugClearMemoryValue, and returns the target buffer.\r
490\r
491 This function fills Length bytes of Buffer with the value specified by\r
492 PcdDebugClearMemoryValue, and returns Buffer.\r
493\r
494 If Buffer is NULL, then ASSERT().\r
495 If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT().\r
496\r
497 @param Buffer Pointer to the target buffer to be filled with PcdDebugClearMemoryValue.\r
498 @param Length Number of bytes in Buffer to fill with zeros PcdDebugClearMemoryValue.\r
499\r
500 @return Buffer Pointer to the target buffer filled with PcdDebugClearMemoryValue.\r
501\r
502**/\r
503VOID *\r
504EFIAPI\r
505DebugClearMemory (\r
506 OUT VOID *Buffer,\r
507 IN UINTN Length\r
508 )\r
509{\r
510 ASSERT (Buffer != NULL);\r
511\r
512 return SetMem (Buffer, Length, PcdGet8 (PcdDebugClearMemoryValue));\r
513}\r
514\r
515/**\r
516 Returns TRUE if ASSERT() macros are enabled.\r
517\r
518 This function returns TRUE if the DEBUG_PROPERTY_DEBUG_ASSERT_ENABLED bit of\r
519 PcdDebugProperyMask is set. Otherwise FALSE is returned.\r
520\r
521 @retval TRUE The DEBUG_PROPERTY_DEBUG_ASSERT_ENABLED bit of PcdDebugProperyMask is set.\r
522 @retval FALSE The DEBUG_PROPERTY_DEBUG_ASSERT_ENABLED bit of PcdDebugProperyMask is clear.\r
523\r
524**/\r
525BOOLEAN\r
526EFIAPI\r
527DebugAssertEnabled (\r
528 VOID\r
529 )\r
530{\r
531 return (BOOLEAN)((PcdGet8 (PcdDebugPropertyMask) & DEBUG_PROPERTY_DEBUG_ASSERT_ENABLED) != 0);\r
532}\r
533\r
534/**\r
535 Returns TRUE if DEBUG() macros are enabled.\r
536\r
537 This function returns TRUE if the DEBUG_PROPERTY_DEBUG_PRINT_ENABLED bit of\r
538 PcdDebugProperyMask is set. Otherwise FALSE is returned.\r
539\r
540 @retval TRUE The DEBUG_PROPERTY_DEBUG_PRINT_ENABLED bit of PcdDebugProperyMask is set.\r
541 @retval FALSE The DEBUG_PROPERTY_DEBUG_PRINT_ENABLED bit of PcdDebugProperyMask is clear.\r
542\r
543**/\r
544BOOLEAN\r
545EFIAPI\r
546DebugPrintEnabled (\r
547 VOID\r
548 )\r
549{\r
550 return (BOOLEAN)((PcdGet8 (PcdDebugPropertyMask) & DEBUG_PROPERTY_DEBUG_PRINT_ENABLED) != 0);\r
551}\r
552\r
553/**\r
554 Returns TRUE if DEBUG_CODE() macros are enabled.\r
555\r
556 This function returns TRUE if the DEBUG_PROPERTY_DEBUG_CODE_ENABLED bit of\r
557 PcdDebugProperyMask is set. Otherwise FALSE is returned.\r
558\r
559 @retval TRUE The DEBUG_PROPERTY_DEBUG_CODE_ENABLED bit of PcdDebugProperyMask is set.\r
560 @retval FALSE The DEBUG_PROPERTY_DEBUG_CODE_ENABLED bit of PcdDebugProperyMask is clear.\r
561\r
562**/\r
563BOOLEAN\r
564EFIAPI\r
565DebugCodeEnabled (\r
566 VOID\r
567 )\r
568{\r
569 return (BOOLEAN)((PcdGet8 (PcdDebugPropertyMask) & DEBUG_PROPERTY_DEBUG_CODE_ENABLED) != 0);\r
570}\r
571\r
572/**\r
573 Returns TRUE if DEBUG_CLEAR_MEMORY() macro is enabled.\r
574\r
575 This function returns TRUE if the DEBUG_PROPERTY_CLEAR_MEMORY_ENABLED bit of\r
576 PcdDebugProperyMask is set. Otherwise FALSE is returned.\r
577\r
578 @retval TRUE The DEBUG_PROPERTY_CLEAR_MEMORY_ENABLED bit of PcdDebugProperyMask is set.\r
579 @retval FALSE The DEBUG_PROPERTY_CLEAR_MEMORY_ENABLED bit of PcdDebugProperyMask is clear.\r
580\r
581**/\r
582BOOLEAN\r
583EFIAPI\r
584DebugClearMemoryEnabled (\r
585 VOID\r
586 )\r
587{\r
588 return (BOOLEAN)((PcdGet8 (PcdDebugPropertyMask) & DEBUG_PROPERTY_CLEAR_MEMORY_ENABLED) != 0);\r
589}\r
590\r
591/**\r
592 Returns TRUE if any one of the bit is set both in ErrorLevel and PcdFixedDebugPrintErrorLevel.\r
593\r
594 This function compares the bit mask of ErrorLevel and PcdFixedDebugPrintErrorLevel.\r
595\r
596 @retval TRUE Current ErrorLevel is supported.\r
597 @retval FALSE Current ErrorLevel is not supported.\r
598\r
599**/\r
600BOOLEAN\r
601EFIAPI\r
602DebugPrintLevelEnabled (\r
603 IN CONST UINTN ErrorLevel\r
604 )\r
605{\r
606 return (BOOLEAN)((ErrorLevel & PcdGet32 (PcdFixedDebugPrintErrorLevel)) != 0);\r
607}\r