1 /** @file
2   Null Base Debug Library instance with empty functions.
3 
4   Copyright (c) 2006 - 2015, 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
DebugPrint(IN UINTN ErrorLevel,IN CONST CHAR8 * Format,...)35 DebugPrint (
36   IN  UINTN        ErrorLevel,
37   IN  CONST CHAR8  *Format,
38   ...
39   )
40 {
41 }
42 
43 
44 /**
45   Prints an assert message containing a filename, line number, and description.
46   This may be followed by a breakpoint or a dead loop.
47 
48   Print a message of the form "ASSERT <FileName>(<LineNumber>): <Description>\n"
49   to the debug output device.  If DEBUG_PROPERTY_ASSERT_BREAKPOINT_ENABLED bit of
50   PcdDebugProperyMask is set then CpuBreakpoint() is called. Otherwise, if
51   DEBUG_PROPERTY_ASSERT_DEADLOOP_ENABLED bit of PcdDebugProperyMask is set then
52   CpuDeadLoop() is called.  If neither of these bits are set, then this function
53   returns immediately after the message is printed to the debug output device.
54   DebugAssert() must actively prevent recursion.  If DebugAssert() is called while
55   processing another DebugAssert(), then DebugAssert() must return immediately.
56 
57   If FileName is NULL, then a <FileName> string of "(NULL) Filename" is printed.
58   If Description is NULL, then a <Description> string of "(NULL) Description" is printed.
59 
60   @param  FileName     The pointer to the name of the source file that generated the assert condition.
61   @param  LineNumber   The line number in the source file that generated the assert condition
62   @param  Description  The pointer to the description of the assert condition.
63 
64 **/
65 VOID
66 EFIAPI
DebugAssert(IN CONST CHAR8 * FileName,IN UINTN LineNumber,IN CONST CHAR8 * Description)67 DebugAssert (
68   IN CONST CHAR8  *FileName,
69   IN UINTN        LineNumber,
70   IN CONST CHAR8  *Description
71   )
72 {
73 }
74 
75 
76 /**
77   Fills a target buffer with PcdDebugClearMemoryValue, and returns the target buffer.
78 
79   This function fills Length bytes of Buffer with the value specified by
80   PcdDebugClearMemoryValue, and returns Buffer.
81 
82   If Buffer is NULL, then ASSERT().
83   If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT().
84 
85   @param   Buffer  The pointer to the target buffer to be filled with PcdDebugClearMemoryValue.
86   @param   Length  The number of bytes in Buffer to fill with zeros PcdDebugClearMemoryValue.
87 
88   @return  Buffer  The pointer to the target buffer filled with PcdDebugClearMemoryValue.
89 
90 **/
91 VOID *
92 EFIAPI
DebugClearMemory(OUT VOID * Buffer,IN UINTN Length)93 DebugClearMemory (
94   OUT VOID  *Buffer,
95   IN UINTN  Length
96   )
97 {
98   return Buffer;
99 }
100 
101 
102 /**
103   Returns TRUE if ASSERT() macros are enabled.
104 
105   This function returns TRUE if the DEBUG_PROPERTY_DEBUG_ASSERT_ENABLED bit of
106   PcdDebugProperyMask is set.  Otherwise FALSE is returned.
107 
108   @retval  TRUE    The DEBUG_PROPERTY_DEBUG_ASSERT_ENABLED bit of PcdDebugProperyMask is set.
109   @retval  FALSE   The DEBUG_PROPERTY_DEBUG_ASSERT_ENABLED bit of PcdDebugProperyMask is clear.
110 
111 **/
112 BOOLEAN
113 EFIAPI
DebugAssertEnabled(VOID)114 DebugAssertEnabled (
115   VOID
116   )
117 {
118   return FALSE;
119 }
120 
121 
122 /**
123   Returns TRUE if DEBUG() macros are enabled.
124 
125   This function returns TRUE if the DEBUG_PROPERTY_DEBUG_PRINT_ENABLED bit of
126   PcdDebugProperyMask is set.  Otherwise FALSE is returned.
127 
128   @retval  TRUE    The DEBUG_PROPERTY_DEBUG_PRINT_ENABLED bit of PcdDebugProperyMask is set.
129   @retval  FALSE   The DEBUG_PROPERTY_DEBUG_PRINT_ENABLED bit of PcdDebugProperyMask is clear.
130 
131 **/
132 BOOLEAN
133 EFIAPI
DebugPrintEnabled(VOID)134 DebugPrintEnabled (
135   VOID
136   )
137 {
138   return FALSE;
139 }
140 
141 
142 /**
143   Returns TRUE if DEBUG_CODE() macros are enabled.
144 
145   This function returns TRUE if the DEBUG_PROPERTY_DEBUG_CODE_ENABLED bit of
146   PcdDebugProperyMask is set.  Otherwise FALSE is returned.
147 
148   @retval  TRUE    The DEBUG_PROPERTY_DEBUG_CODE_ENABLED bit of PcdDebugProperyMask is set.
149   @retval  FALSE   The DEBUG_PROPERTY_DEBUG_CODE_ENABLED bit of PcdDebugProperyMask is clear.
150 
151 **/
152 BOOLEAN
153 EFIAPI
DebugCodeEnabled(VOID)154 DebugCodeEnabled (
155   VOID
156   )
157 {
158   return FALSE;
159 }
160 
161 
162 /**
163   Returns TRUE if DEBUG_CLEAR_MEMORY() macro is enabled.
164 
165   This function returns TRUE if the DEBUG_PROPERTY_CLEAR_MEMORY_ENABLED bit of
166   PcdDebugProperyMask is set.  Otherwise FALSE is returned.
167 
168   @retval  TRUE    The DEBUG_PROPERTY_CLEAR_MEMORY_ENABLED bit of PcdDebugProperyMask is set.
169   @retval  FALSE   The DEBUG_PROPERTY_CLEAR_MEMORY_ENABLED bit of PcdDebugProperyMask is clear.
170 
171 **/
172 BOOLEAN
173 EFIAPI
DebugClearMemoryEnabled(VOID)174 DebugClearMemoryEnabled (
175   VOID
176   )
177 {
178   return FALSE;
179 }
180 
181 /**
182   Returns TRUE if any one of the bit is set both in ErrorLevel and PcdFixedDebugPrintErrorLevel.
183 
184   This function compares the bit mask of ErrorLevel and PcdFixedDebugPrintErrorLevel.
185 
186   @retval  TRUE    Current ErrorLevel is supported.
187   @retval  FALSE   Current ErrorLevel is not supported.
188 
189 **/
190 BOOLEAN
191 EFIAPI
DebugPrintLevelEnabled(IN CONST UINTN ErrorLevel)192 DebugPrintLevelEnabled (
193   IN  CONST UINTN        ErrorLevel
194   )
195 {
196   return FALSE;
197 }
198 
199