]> git.proxmox.com Git - mirror_edk2.git/blob - MdePkg/Library/BaseDebugLibNull/DebugLib.c
MdePkg/BaseDebugLibNull: Add new APIs for DebugLib
[mirror_edk2.git] / MdePkg / Library / BaseDebugLibNull / DebugLib.c
1 /** @file
2 Null Base Debug Library instance with empty functions.
3
4 Copyright (c) 2006 - 2019, Intel Corporation. All rights reserved.<BR>
5 This program and the accompanying materials
6 are licensed and made available under the terms and conditions of the BSD License
7 which accompanies this distribution. The full text of the license may be found at
8 http://opensource.org/licenses/bsd-license.php.
9
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
12
13 **/
14
15 #include <Base.h>
16 #include <Library/DebugLib.h>
17
18 /**
19 Prints a debug message to the debug output device if the specified error level is enabled.
20
21 If any bit in ErrorLevel is also set in DebugPrintErrorLevelLib function
22 GetDebugPrintErrorLevel (), then print the message specified by Format and the
23 associated variable argument list to the debug output device.
24
25 If Format is NULL, then ASSERT().
26
27 @param ErrorLevel The error level of the debug message.
28 @param Format Format string for the debug message to print.
29 @param ... Variable argument list whose contents are accessed
30 based on the format string specified by Format.
31
32 **/
33 VOID
34 EFIAPI
35 DebugPrint (
36 IN UINTN ErrorLevel,
37 IN CONST CHAR8 *Format,
38 ...
39 )
40 {
41 }
42
43
44 /**
45 Prints a debug message to the debug output device if the specified
46 error level is enabled.
47
48 If any bit in ErrorLevel is also set in DebugPrintErrorLevelLib function
49 GetDebugPrintErrorLevel (), then print the message specified by Format and
50 the associated variable argument list to the debug output device.
51
52 If Format is NULL, then ASSERT().
53
54 @param ErrorLevel The error level of the debug message.
55 @param Format Format string for the debug message to print.
56 @param VaListMarker VA_LIST marker for the variable argument list.
57
58 **/
59 VOID
60 EFIAPI
61 DebugVPrint (
62 IN UINTN ErrorLevel,
63 IN CONST CHAR8 *Format,
64 IN VA_LIST VaListMarker
65 )
66 {
67 }
68
69
70 /**
71 Prints a debug message to the debug output device if the specified
72 error level is enabled.
73 This function use BASE_LIST which would provide a more compatible
74 service than VA_LIST.
75
76 If any bit in ErrorLevel is also set in DebugPrintErrorLevelLib function
77 GetDebugPrintErrorLevel (), then print the message specified by Format and
78 the associated variable argument list to the debug output device.
79
80 If Format is NULL, then ASSERT().
81
82 @param ErrorLevel The error level of the debug message.
83 @param Format Format string for the debug message to print.
84 @param BaseListMarker BASE_LIST marker for the variable argument list.
85
86 **/
87 VOID
88 EFIAPI
89 DebugBPrint (
90 IN UINTN ErrorLevel,
91 IN CONST CHAR8 *Format,
92 IN BASE_LIST BaseListMarker
93 )
94 {
95 }
96
97
98 /**
99 Prints an assert message containing a filename, line number, and description.
100 This may be followed by a breakpoint or a dead loop.
101
102 Print a message of the form "ASSERT <FileName>(<LineNumber>): <Description>\n"
103 to the debug output device. If DEBUG_PROPERTY_ASSERT_BREAKPOINT_ENABLED bit of
104 PcdDebugProperyMask is set then CpuBreakpoint() is called. Otherwise, if
105 DEBUG_PROPERTY_ASSERT_DEADLOOP_ENABLED bit of PcdDebugProperyMask is set then
106 CpuDeadLoop() is called. If neither of these bits are set, then this function
107 returns immediately after the message is printed to the debug output device.
108 DebugAssert() must actively prevent recursion. If DebugAssert() is called while
109 processing another DebugAssert(), then DebugAssert() must return immediately.
110
111 If FileName is NULL, then a <FileName> string of "(NULL) Filename" is printed.
112 If Description is NULL, then a <Description> string of "(NULL) Description" is printed.
113
114 @param FileName The pointer to the name of the source file that generated the assert condition.
115 @param LineNumber The line number in the source file that generated the assert condition
116 @param Description The pointer to the description of the assert condition.
117
118 **/
119 VOID
120 EFIAPI
121 DebugAssert (
122 IN CONST CHAR8 *FileName,
123 IN UINTN LineNumber,
124 IN CONST CHAR8 *Description
125 )
126 {
127 }
128
129
130 /**
131 Fills a target buffer with PcdDebugClearMemoryValue, and returns the target buffer.
132
133 This function fills Length bytes of Buffer with the value specified by
134 PcdDebugClearMemoryValue, and returns Buffer.
135
136 If Buffer is NULL, then ASSERT().
137 If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT().
138
139 @param Buffer The pointer to the target buffer to be filled with PcdDebugClearMemoryValue.
140 @param Length The number of bytes in Buffer to fill with zeros PcdDebugClearMemoryValue.
141
142 @return Buffer The pointer to the target buffer filled with PcdDebugClearMemoryValue.
143
144 **/
145 VOID *
146 EFIAPI
147 DebugClearMemory (
148 OUT VOID *Buffer,
149 IN UINTN Length
150 )
151 {
152 return Buffer;
153 }
154
155
156 /**
157 Returns TRUE if ASSERT() macros are enabled.
158
159 This function returns TRUE if the DEBUG_PROPERTY_DEBUG_ASSERT_ENABLED bit of
160 PcdDebugProperyMask is set. Otherwise FALSE is returned.
161
162 @retval TRUE The DEBUG_PROPERTY_DEBUG_ASSERT_ENABLED bit of PcdDebugProperyMask is set.
163 @retval FALSE The DEBUG_PROPERTY_DEBUG_ASSERT_ENABLED bit of PcdDebugProperyMask is clear.
164
165 **/
166 BOOLEAN
167 EFIAPI
168 DebugAssertEnabled (
169 VOID
170 )
171 {
172 return FALSE;
173 }
174
175
176 /**
177 Returns TRUE if DEBUG() macros are enabled.
178
179 This function returns TRUE if the DEBUG_PROPERTY_DEBUG_PRINT_ENABLED bit of
180 PcdDebugProperyMask is set. Otherwise FALSE is returned.
181
182 @retval TRUE The DEBUG_PROPERTY_DEBUG_PRINT_ENABLED bit of PcdDebugProperyMask is set.
183 @retval FALSE The DEBUG_PROPERTY_DEBUG_PRINT_ENABLED bit of PcdDebugProperyMask is clear.
184
185 **/
186 BOOLEAN
187 EFIAPI
188 DebugPrintEnabled (
189 VOID
190 )
191 {
192 return FALSE;
193 }
194
195
196 /**
197 Returns TRUE if DEBUG_CODE() macros are enabled.
198
199 This function returns TRUE if the DEBUG_PROPERTY_DEBUG_CODE_ENABLED bit of
200 PcdDebugProperyMask is set. Otherwise FALSE is returned.
201
202 @retval TRUE The DEBUG_PROPERTY_DEBUG_CODE_ENABLED bit of PcdDebugProperyMask is set.
203 @retval FALSE The DEBUG_PROPERTY_DEBUG_CODE_ENABLED bit of PcdDebugProperyMask is clear.
204
205 **/
206 BOOLEAN
207 EFIAPI
208 DebugCodeEnabled (
209 VOID
210 )
211 {
212 return FALSE;
213 }
214
215
216 /**
217 Returns TRUE if DEBUG_CLEAR_MEMORY() macro is enabled.
218
219 This function returns TRUE if the DEBUG_PROPERTY_CLEAR_MEMORY_ENABLED bit of
220 PcdDebugProperyMask is set. Otherwise FALSE is returned.
221
222 @retval TRUE The DEBUG_PROPERTY_CLEAR_MEMORY_ENABLED bit of PcdDebugProperyMask is set.
223 @retval FALSE The DEBUG_PROPERTY_CLEAR_MEMORY_ENABLED bit of PcdDebugProperyMask is clear.
224
225 **/
226 BOOLEAN
227 EFIAPI
228 DebugClearMemoryEnabled (
229 VOID
230 )
231 {
232 return FALSE;
233 }
234
235 /**
236 Returns TRUE if any one of the bit is set both in ErrorLevel and PcdFixedDebugPrintErrorLevel.
237
238 This function compares the bit mask of ErrorLevel and PcdFixedDebugPrintErrorLevel.
239
240 @retval TRUE Current ErrorLevel is supported.
241 @retval FALSE Current ErrorLevel is not supported.
242
243 **/
244 BOOLEAN
245 EFIAPI
246 DebugPrintLevelEnabled (
247 IN CONST UINTN ErrorLevel
248 )
249 {
250 return FALSE;
251 }
252