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