]> git.proxmox.com Git - mirror_edk2.git/blob - MdePkg/Library/BaseReportStatusCodeLibNull/BaseReportStatusCodeLib.c
MdePkg: Replace BSD License with BSD+Patent License
[mirror_edk2.git] / MdePkg / Library / BaseReportStatusCodeLibNull / BaseReportStatusCodeLib.c
1 /** @file
2 Null Base Report Status Code Library instance with empty functions.
3
4 Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.<BR>
5 SPDX-License-Identifier: BSD-2-Clause-Patent
6
7 **/
8
9 #include <Base.h>
10 #include <Library/ReportStatusCodeLib.h>
11 #include <Library/DebugLib.h>
12
13 /**
14 Converts a status code to an 8-bit POST code value.
15
16 Converts the status code specified by CodeType and Value to an 8-bit POST code
17 and returns the 8-bit POST code in PostCode. If CodeType is an
18 EFI_PROGRESS_CODE or CodeType is an EFI_ERROR_CODE, then bits 0..4 of PostCode
19 are set to bits 16..20 of Value, and bits 5..7 of PostCode are set to bits
20 24..26 of Value., and TRUE is returned. Otherwise, FALSE is returned.
21
22 If PostCode is NULL, then ASSERT().
23
24 @param CodeType The type of status code being converted.
25 @param Value The status code value being converted.
26 @param PostCode A pointer to the 8-bit POST code value to return.
27
28 @retval TRUE The status code specified by CodeType and Value was converted
29 to an 8-bit POST code and returned in PostCode.
30 @retval FALSE The status code specified by CodeType and Value could not be
31 converted to an 8-bit POST code value.
32
33 **/
34 BOOLEAN
35 EFIAPI
36 CodeTypeToPostCode (
37 IN EFI_STATUS_CODE_TYPE CodeType,
38 IN EFI_STATUS_CODE_VALUE Value,
39 OUT UINT8 *PostCode
40 )
41 {
42 ASSERT (PostCode != NULL);
43
44 return FALSE;
45 }
46
47
48 /**
49 Extracts ASSERT() information from a status code structure.
50
51 Converts the status code specified by CodeType, Value, and Data to the ASSERT()
52 arguments specified by Filename, Description, and LineNumber. If CodeType is
53 an EFI_ERROR_CODE, and CodeType has a severity of EFI_ERROR_UNRECOVERED, and
54 Value has an operation mask of EFI_SW_EC_ILLEGAL_SOFTWARE_STATE, extract
55 Filename, Description, and LineNumber from the optional data area of the
56 status code buffer specified by Data. The optional data area of Data contains
57 a Null-terminated ASCII string for the FileName, followed by a Null-terminated
58 ASCII string for the Description, followed by a 32-bit LineNumber. If the
59 ASSERT() information could be extracted from Data, then return TRUE.
60 Otherwise, FALSE is returned.
61
62 If Data is NULL, then ASSERT().
63 If Filename is NULL, then ASSERT().
64 If Description is NULL, then ASSERT().
65 If LineNumber is NULL, then ASSERT().
66
67 @param CodeType The type of status code being converted.
68 @param Value The status code value being converted.
69 @param Data The pointer to the status code data buffer.
70 @param Filename The pointer to the source file name that generated the ASSERT().
71 @param Description The pointer to the description of the ASSERT().
72 @param LineNumber The pointer to the source line number that generated the ASSERT().
73
74 @retval TRUE The status code specified by CodeType, Value, and Data was
75 converted ASSERT() arguments specified by Filename, Description,
76 and LineNumber.
77 @retval FALSE The status code specified by CodeType, Value, and Data could
78 not be converted to ASSERT() arguments.
79
80 **/
81 BOOLEAN
82 EFIAPI
83 ReportStatusCodeExtractAssertInfo (
84 IN EFI_STATUS_CODE_TYPE CodeType,
85 IN EFI_STATUS_CODE_VALUE Value,
86 IN CONST EFI_STATUS_CODE_DATA *Data,
87 OUT CHAR8 **Filename,
88 OUT CHAR8 **Description,
89 OUT UINT32 *LineNumber
90 )
91 {
92 return FALSE;
93 }
94
95
96 /**
97 Extracts DEBUG() information from a status code structure.
98
99 Converts the status code specified by Data to the DEBUG() arguments specified
100 by ErrorLevel, Marker, and Format. If type GUID in Data is
101 EFI_STATUS_CODE_DATA_TYPE_DEBUG_GUID, then extract ErrorLevel, Marker, and
102 Format from the optional data area of the status code buffer specified by Data.
103 The optional data area of Data contains a 32-bit ErrorLevel followed by Marker
104 which is 12 UINTN parameters, followed by a Null-terminated ASCII string for
105 the Format. If the DEBUG() information could be extracted from Data, then
106 return TRUE. Otherwise, FALSE is returned.
107
108 If Data is NULL, then ASSERT().
109 If ErrorLevel is NULL, then ASSERT().
110 If Marker is NULL, then ASSERT().
111 If Format is NULL, then ASSERT().
112
113 @param Data The pointer to the status code data buffer.
114 @param ErrorLevel The pointer to the error level mask for a debug message.
115 @param Marker The pointer to the variable argument list associated with Format.
116 @param Format The pointer to a Null-terminated ASCII format string of a
117 debug message.
118
119 @retval TRUE The status code specified by Data was converted DEBUG() arguments
120 specified by ErrorLevel, Marker, and Format.
121 @retval FALSE The status code specified by Data could not be converted to
122 DEBUG() arguments.
123
124 **/
125 BOOLEAN
126 EFIAPI
127 ReportStatusCodeExtractDebugInfo (
128 IN CONST EFI_STATUS_CODE_DATA *Data,
129 OUT UINT32 *ErrorLevel,
130 OUT BASE_LIST *Marker,
131 OUT CHAR8 **Format
132 )
133 {
134 ASSERT (Data != NULL);
135 ASSERT (ErrorLevel != NULL);
136 ASSERT (Marker != NULL);
137 ASSERT (Format != NULL);
138
139 return FALSE;
140 }
141
142
143 /**
144 Reports a status code.
145
146 Reports the status code specified by the parameters Type and Value. Status
147 code also require an instance, caller ID, and extended data. This function
148 passed in a zero instance, NULL extended data, and a caller ID of
149 gEfiCallerIdGuid, which is the GUID for the module.
150
151 ReportStatusCode()must actively prevent recursion. If ReportStatusCode()
152 is called while processing another any other Report Status Code Library function,
153 then ReportStatusCode() must return immediately.
154
155 @param Type The status code type.
156 @param Value The status code value.
157
158 @retval EFI_SUCCESS The status code was reported.
159 @retval EFI_DEVICE_ERROR There status code could not be reported due to a
160 device error.
161 @retval EFI_UNSUPPORTED The report status code is not supported.
162
163 **/
164 EFI_STATUS
165 EFIAPI
166 ReportStatusCode (
167 IN EFI_STATUS_CODE_TYPE Type,
168 IN EFI_STATUS_CODE_VALUE Value
169 )
170 {
171 return EFI_SUCCESS;
172 }
173
174
175 /**
176 Reports a status code with a Device Path Protocol as the extended data.
177
178 Allocates and fills in the extended data section of a status code with the
179 Device Path Protocol specified by DevicePath. This function is responsible
180 for allocating a buffer large enough for the standard header and the device
181 path. The standard header is filled in with a GUID of
182 gEfiStatusCodeSpecificDataGuid. The status code is reported with a zero
183 instance and a caller ID of gEfiCallerIdGuid.
184
185 ReportStatusCodeWithDevicePath()must actively prevent recursion. If
186 ReportStatusCodeWithDevicePath() is called while processing another any other
187 Report Status Code Library function, then ReportStatusCodeWithDevicePath()
188 must return EFI_DEVICE_ERROR immediately.
189
190 If DevicePath is NULL, then ASSERT().
191
192 @param Type Status code type.
193 @param Value Status code value.
194 @param DevicePath The pointer to the Device Path Protocol to be reported.
195
196 @retval EFI_SUCCESS The status code was reported with the extended
197 data specified by DevicePath.
198 @retval EFI_OUT_OF_RESOURCES There were not enough resources to allocate the
199 extended data section.
200 @retval EFI_UNSUPPORTED The report status code is not supported
201
202 **/
203 EFI_STATUS
204 EFIAPI
205 ReportStatusCodeWithDevicePath (
206 IN EFI_STATUS_CODE_TYPE Type,
207 IN EFI_STATUS_CODE_VALUE Value,
208 IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath
209 )
210 {
211 ASSERT (DevicePath != NULL);
212
213 return EFI_SUCCESS;
214 }
215
216
217 /**
218 Reports a status code with an extended data buffer.
219
220 Allocates and fills in the extended data section of a status code with the
221 extended data specified by ExtendedData and ExtendedDataSize. ExtendedData
222 is assumed to be one of the data structures specified in Related Definitions.
223 These data structure do not have the standard header, so this function is
224 responsible for allocating a buffer large enough for the standard header and
225 the extended data passed into this function. The standard header is filled
226 in with a GUID of gEfiStatusCodeSpecificDataGuid. The status code is reported
227 with a zero instance and a caller ID of gEfiCallerIdGuid.
228
229 ReportStatusCodeWithExtendedData()must actively prevent recursion. If
230 ReportStatusCodeWithExtendedData() is called while processing another any other
231 Report Status Code Library function, then ReportStatusCodeWithExtendedData()
232 must return EFI_DEVICE_ERROR immediately.
233
234 If ExtendedData is NULL, then ASSERT().
235 If ExtendedDataSize is 0, then ASSERT().
236
237 @param Type Status code type.
238 @param Value Status code value.
239 @param ExtendedData The pointer to the extended data buffer to be reported.
240 @param ExtendedDataSize The size, in bytes, of the extended data buffer to
241 be reported.
242
243 @retval EFI_SUCCESS The status code was reported with the extended
244 data specified by ExtendedData and ExtendedDataSize.
245 @retval EFI_OUT_OF_RESOURCES There were not enough resources to allocate the
246 extended data section.
247 @retval EFI_UNSUPPORTED The report status code is not supported.
248
249 **/
250 EFI_STATUS
251 EFIAPI
252 ReportStatusCodeWithExtendedData (
253 IN EFI_STATUS_CODE_TYPE Type,
254 IN EFI_STATUS_CODE_VALUE Value,
255 IN CONST VOID *ExtendedData,
256 IN UINTN ExtendedDataSize
257 )
258 {
259 ASSERT (ExtendedData != NULL);
260 ASSERT (ExtendedDataSize != 0);
261 return EFI_SUCCESS;
262 }
263
264
265 /**
266 Reports a status code with full parameters.
267
268 The function reports a status code. If ExtendedData is NULL and ExtendedDataSize
269 is 0, then an extended data buffer is not reported. If ExtendedData is not
270 NULL and ExtendedDataSize is not 0, then an extended data buffer is allocated.
271 ExtendedData is assumed not have the standard status code header, so this function
272 is responsible for allocating a buffer large enough for the standard header and
273 the extended data passed into this function. The standard header is filled in
274 with a GUID specified by ExtendedDataGuid. If ExtendedDataGuid is NULL, then a
275 GUID of gEfiStatusCodeSpecificDataGuid is used. The status code is reported with
276 an instance specified by Instance and a caller ID specified by CallerId. If
277 CallerId is NULL, then a caller ID of gEfiCallerIdGuid is used.
278
279 ReportStatusCodeEx()must actively prevent recursion. If ReportStatusCodeEx()
280 is called while processing another any other Report Status Code Library function,
281 then ReportStatusCodeEx() must return EFI_DEVICE_ERROR immediately.
282
283 If ExtendedData is NULL and ExtendedDataSize is not zero, then ASSERT().
284 If ExtendedData is not NULL and ExtendedDataSize is zero, then ASSERT().
285
286 @param Type The status code type.
287 @param Value The status code value.
288 @param Instance Status code instance number.
289 @param CallerId The pointer to a GUID that identifies the caller of this
290 function. If this parameter is NULL, then a caller
291 ID of gEfiCallerIdGuid is used.
292 @param ExtendedDataGuid The pointer to the GUID for the extended data buffer.
293 If this parameter is NULL, then a the status code
294 standard header is filled in with
295 gEfiStatusCodeSpecificDataGuid.
296 @param ExtendedData The pointer to the extended data buffer. This is an
297 optional parameter that may be NULL.
298 @param ExtendedDataSize The size, in bytes, of the extended data buffer.
299
300 @retval EFI_SUCCESS The status code was reported.
301 @retval EFI_OUT_OF_RESOURCES There were not enough resources to allocate
302 the extended data section if it was specified.
303 @retval EFI_UNSUPPORTED The report status code is not supported.
304
305 **/
306 EFI_STATUS
307 EFIAPI
308 ReportStatusCodeEx (
309 IN EFI_STATUS_CODE_TYPE Type,
310 IN EFI_STATUS_CODE_VALUE Value,
311 IN UINT32 Instance,
312 IN CONST EFI_GUID *CallerId OPTIONAL,
313 IN CONST EFI_GUID *ExtendedDataGuid OPTIONAL,
314 IN CONST VOID *ExtendedData OPTIONAL,
315 IN UINTN ExtendedDataSize
316 )
317 {
318 return EFI_SUCCESS;
319 }
320
321
322 /**
323 Returns TRUE if status codes of type EFI_PROGRESS_CODE are enabled
324
325 This function returns TRUE if the REPORT_STATUS_CODE_PROPERTY_PROGRESS_CODE_ENABLED
326 bit of PcdReportStatusCodeProperyMask is set. Otherwise FALSE is returned.
327
328 @retval TRUE The REPORT_STATUS_CODE_PROPERTY_PROGRESS_CODE_ENABLED bit of
329 PcdReportStatusCodeProperyMask is set.
330 @retval FALSE The REPORT_STATUS_CODE_PROPERTY_PROGRESS_CODE_ENABLED bit of
331 PcdReportStatusCodeProperyMask is clear.
332
333 **/
334 BOOLEAN
335 EFIAPI
336 ReportProgressCodeEnabled (
337 VOID
338 )
339 {
340 return FALSE;
341 }
342
343
344 /**
345 Returns TRUE if status codes of type EFI_ERROR_CODE are enabled
346
347 This function returns TRUE if the REPORT_STATUS_CODE_PROPERTY_ERROR_CODE_ENABLED
348 bit of PcdReportStatusCodeProperyMask is set. Otherwise FALSE is returned.
349
350 @retval TRUE The REPORT_STATUS_CODE_PROPERTY_ERROR_CODE_ENABLED bit of
351 PcdReportStatusCodeProperyMask is set.
352 @retval FALSE The REPORT_STATUS_CODE_PROPERTY_ERROR_CODE_ENABLED bit of
353 PcdReportStatusCodeProperyMask is clear.
354
355 **/
356 BOOLEAN
357 EFIAPI
358 ReportErrorCodeEnabled (
359 VOID
360 )
361 {
362 return FALSE;
363 }
364
365
366 /**
367 Returns TRUE if status codes of type EFI_DEBUG_CODE are enabled
368
369 This function returns TRUE if the REPORT_STATUS_CODE_PROPERTY_DEBUG_CODE_ENABLED
370 bit of PcdReportStatusCodeProperyMask is set. Otherwise FALSE is returned.
371
372 @retval TRUE The REPORT_STATUS_CODE_PROPERTY_DEBUG_CODE_ENABLED bit of
373 PcdReportStatusCodeProperyMask is set.
374 @retval FALSE The REPORT_STATUS_CODE_PROPERTY_DEBUG_CODE_ENABLED bit of
375 PcdReportStatusCodeProperyMask is clear.
376
377 **/
378 BOOLEAN
379 EFIAPI
380 ReportDebugCodeEnabled (
381 VOID
382 )
383 {
384 return FALSE;
385 }
386