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