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