]>
Commit | Line | Data |
---|---|---|
878ddf1f | 1 | /** @file\r |
2 | Debug Library that fowards all messages to ReportStatusCode()\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 | /**\r | |
17 | \r | |
18 | Prints a debug message to the debug output device if the specified error level is enabled.\r | |
19 | \r | |
20 | If any bit in ErrorLevel is also set in PcdDebugPrintErrorLevel, then print \r | |
21 | the message specified by Format and the associated variable argument list to \r | |
22 | the debug output device.\r | |
23 | \r | |
24 | If Format is NULL, then ASSERT().\r | |
25 | \r | |
26 | @param ErrorLevel The error level of the debug message.\r | |
27 | @param Format Format string for the debug message to print.\r | |
28 | \r | |
29 | **/\r | |
30 | VOID\r | |
31 | EFIAPI\r | |
32 | DebugPrint (\r | |
9b65a1b8 | 33 | IN UINTN ErrorLevel,\r |
34 | IN CONST CHAR8 *Format,\r | |
878ddf1f | 35 | ...\r |
36 | )\r | |
37 | {\r | |
38 | UINT64 Buffer[EFI_STATUS_CODE_DATA_MAX_SIZE / sizeof (UINT64)];\r | |
39 | EFI_DEBUG_INFO *DebugInfo;\r | |
40 | UINTN TotalSize;\r | |
41 | UINTN Index;\r | |
42 | VA_LIST Marker;\r | |
43 | UINT64 *ArgumentPointer;\r | |
44 | \r | |
45 | //\r | |
46 | // If Format is NULL, then ASSERT().\r | |
47 | //\r | |
48 | ASSERT (Format != NULL);\r | |
49 | \r | |
50 | //\r | |
51 | // Check driver Debug Level value and global debug level\r | |
52 | //\r | |
53 | if ((ErrorLevel & PcdGet32(PcdDebugPrintErrorLevel)) == 0) {\r | |
54 | return;\r | |
55 | }\r | |
56 | \r | |
57 | TotalSize = sizeof (EFI_DEBUG_INFO) + 12 * sizeof (UINT64) + AsciiStrLen (Format) + 1;\r | |
58 | if (TotalSize > EFI_STATUS_CODE_DATA_MAX_SIZE) {\r | |
59 | return;\r | |
60 | }\r | |
61 | \r | |
62 | //\r | |
63 | // Then EFI_DEBUG_INFO\r | |
64 | //\r | |
65 | DebugInfo = (EFI_DEBUG_INFO *)Buffer;\r | |
66 | DebugInfo->ErrorLevel = (UINT32)ErrorLevel;\r | |
67 | \r | |
68 | //\r | |
69 | // 256 byte mini Var Arg stack. That is followed by the format string.\r | |
70 | //\r | |
71 | VA_START (Marker, Format);\r | |
72 | for (Index = 0, ArgumentPointer = (UINT64 *)(DebugInfo + 1); Index < 12; Index++, ArgumentPointer++) {\r | |
73 | *ArgumentPointer = VA_ARG (Marker, UINT64);\r | |
74 | }\r | |
75 | VA_END (Marker);\r | |
76 | AsciiStrCpy ((CHAR8 *)ArgumentPointer, Format);\r | |
77 | \r | |
78 | //\r | |
79 | //\r | |
80 | //\r | |
81 | REPORT_STATUS_CODE_WITH_EXTENDED_DATA (\r | |
82 | EFI_DEBUG_CODE,\r | |
83 | (EFI_SOFTWARE_DXE_BS_DRIVER | EFI_DC_UNSPECIFIED),\r | |
84 | DebugInfo,\r | |
85 | TotalSize\r | |
86 | );\r | |
87 | }\r | |
88 | \r | |
89 | \r | |
90 | /**\r | |
91 | \r | |
92 | Prints an assert message containing a filename, line number, and description. \r | |
93 | This may be followed by a breakpoint or a dead loop.\r | |
94 | \r | |
95 |