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