]> git.proxmox.com Git - mirror_edk2.git/blame - MdePkg/Library/BaseReportStatusCodeLibNull/BaseReportStatusCodeLib.c
Add more details to OvmfPkg/README for building & running.
[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
4 Copyright (c) 2009, Intel Corporation<BR>\r
5 All rights reserved. This program and the accompanying materials\r
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
8 http://opensource.org/licenses/bsd-license.php\r
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
75 @param Data Pointer to status code data buffer.\r
76 @param Filename Pointer to the source file name that generated the ASSERT().\r
77 @param Description Pointer to the description of the ASSERT().\r
78 @param LineNumber Pointer to source line number that generated the ASSERT().\r
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
119 @param Data Pointer to status code data buffer.\r
120 @param ErrorLevel Pointer to error level mask for a debug message.\r
121 @param Marker Pointer to the variable argument list associated with Format.\r
122 @param Format Pointer to a Null-terminated ASCII format string of a\r
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
136 OUT VA_LIST *Marker,\r
137 OUT CHAR8 **Format\r
138 )\r
139{\r
140 return FALSE;\r
141}\r
142\r
143\r
144/**\r
145 Reports a status code.\r
146\r
147 Reports the status code specified by the parameters Type and Value. Status\r
148 code also require an instance, caller ID, and extended data. This function\r
149 passed in a zero instance, NULL extended data, and a caller ID of\r
150 gEfiCallerIdGuid, which is the GUID for the module.\r
151\r
152 ReportStatusCode()must actively prevent recursion. If ReportStatusCode()\r
153 is called while processing another any other Report Status Code Library function,\r
154 then ReportStatusCode() must return immediately.\r
155\r
156 @param Type Status code type.\r
157 @param Value Status code value.\r
158\r
159 @retval EFI_SUCCESS The status code was reported.\r
160 @retval EFI_DEVICE_ERROR There status code could not be reported due to a\r
161 device error.\r
162 @retval EFI_UNSUPPORTED Report status code is not supported\r
163\r
164**/\r
165EFI_STATUS\r
166EFIAPI\r
167ReportStatusCode (\r
168 IN EFI_STATUS_CODE_TYPE Type,\r
169 IN EFI_STATUS_CODE_VALUE Value\r
170 )\r
171{\r
172 return EFI_SUCCESS;\r
173}\r
174\r
175\r
176/**\r
177 Reports a status code with a Device Path Protocol as the extended data.\r
178\r
179 Allocates and fills in the extended data section of a status code with the\r
180 Device Path Protocol specified by DevicePath. This function is responsible\r
181 for allocating a buffer large enough for the standard header and the device\r
182 path. The standard header is filled in with a GUID of\r
183 gEfiStatusCodeSpecificDataGuid. The status code is reported with a zero\r
184 instance and a caller ID of gEfiCallerIdGuid.\r
185\r
186 ReportStatusCodeWithDevicePath()must actively prevent recursion. If\r
187 ReportStatusCodeWithDevicePath() is called while processing another any other\r
188 Report Status Code Library function, then ReportStatusCodeWithDevicePath()\r
189 must return EFI_DEVICE_ERROR immediately.\r
190\r
191 If DevicePath is NULL, then ASSERT().\r
192\r
193 @param Type Status code type.\r
194 @param Value Status code value.\r
195 @param DevicePath Pointer to the Device Path Protocol to be reported.\r
196\r
197 @retval EFI_SUCCESS The status code was reported with the extended\r
198 data specified by DevicePath.\r
199 @retval EFI_OUT_OF_RESOURCES There were not enough resources to allocate the\r
200 extended data section.\r
201 @retval EFI_UNSUPPORTED Report status code is not supported\r
202\r
203**/\r
204EFI_STATUS\r
205EFIAPI\r
206ReportStatusCodeWithDevicePath (\r
207 IN EFI_STATUS_CODE_TYPE Type,\r
208 IN EFI_STATUS_CODE_VALUE Value,\r
209 IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath\r
210 )\r
211{\r
212 ASSERT (DevicePath != NULL);\r
213 \r
214 return EFI_SUCCESS;\r
215}\r
216\r
217\r
218/**\r
219 Reports a status code with an extended data buffer.\r
220\r
221 Allocates and fills in the extended data section of a status code with the\r
222 extended data specified by ExtendedData and ExtendedDataSize. ExtendedData\r
223 is assumed to be one of the data structures specified in Related Definitions.\r
224 These data structure do not have the standard header, so this function is\r
225 responsible for allocating a buffer large enough for the standard header and\r
226 the extended data passed into this function. The standard header is filled\r
227 in with a GUID of gEfiStatusCodeSpecificDataGuid. The status code is reported\r
228 with a zero instance and a caller ID of gEfiCallerIdGuid.\r
229\r
230 ReportStatusCodeWithExtendedData()must actively prevent recursion. If\r
231 ReportStatusCodeWithExtendedData() is called while processing another any other\r
232 Report Status Code Library function, then ReportStatusCodeWithExtendedData()\r
233 must return EFI_DEVICE_ERROR immediately.\r
234\r
235 If ExtendedData is NULL, then ASSERT().\r
236 If ExtendedDataSize is 0, then ASSERT().\r
237\r
238 @param Type Status code type.\r
239 @param Value Status code value.\r
240 @param ExtendedData Pointer to the extended data buffer to be reported.\r
241 @param ExtendedDataSize The size, in bytes, of the extended data buffer to\r
242 be reported.\r
243\r
244 @retval EFI_SUCCESS The status code was reported with the extended\r
245 data specified by ExtendedData and ExtendedDataSize.\r
246 @retval EFI_OUT_OF_RESOURCES There were not enough resources to allocate the\r
247 extended data section.\r
248 @retval EFI_UNSUPPORTED Report status code is not supported\r
249\r
250**/\r
251EFI_STATUS\r
252EFIAPI\r
253ReportStatusCodeWithExtendedData (\r
254 IN EFI_STATUS_CODE_TYPE Type,\r
255 IN EFI_STATUS_CODE_VALUE Value,\r
256 IN CONST VOID *ExtendedData,\r
257 IN UINTN ExtendedDataSize\r
258 )\r
259{\r
260 ASSERT (ExtendedData != NULL);\r
261 ASSERT (ExtendedDataSize != 0);\r
262 return EFI_SUCCESS;\r
263}\r
264\r
265\r
266/**\r
267 Reports a status code with full parameters.\r
268\r
269 The function reports a status code. If ExtendedData is NULL and ExtendedDataSize\r
270 is 0, then an extended data buffer is not reported. If ExtendedData is not\r
271 NULL and ExtendedDataSize is not 0, then an extended data buffer is allocated.\r
272 ExtendedData is assumed not have the standard status code header, so this function\r
273 is responsible for allocating a buffer large enough for the standard header and\r
274 the extended data passed into this function. The standard header is filled in\r
275 with a GUID specified by ExtendedDataGuid. If ExtendedDataGuid is NULL, then a\r
276 GUID of gEfiStatusCodeSpecificDatauid is used. The status code is reported with\r
277 an instance specified by Instance and a caller ID specified by CallerId. If\r
278 CallerId is NULL, then a caller ID of gEfiCallerIdGuid is used.\r
279\r
280 ReportStatusCodeEx()must actively prevent recursion. If ReportStatusCodeEx()\r
281 is called while processing another any other Report Status Code Library function,\r
282 then ReportStatusCodeEx() must return EFI_DEVICE_ERROR immediately.\r
283\r
284 If ExtendedData is NULL and ExtendedDataSize is not zero, then ASSERT().\r
285 If ExtendedData is not NULL and ExtendedDataSize is zero, then ASSERT().\r
286\r
287 @param Type Status code type.\r
288 @param Value Status code value.\r
289 @param Instance Status code instance number.\r
290 @param CallerId Pointer to a GUID that identifies the caller of this\r
291 function. If this parameter is NULL, then a caller\r
292 ID of gEfiCallerIdGuid is used.\r
293 @param ExtendedDataGuid Pointer to the GUID for the extended data buffer.\r
294 If this parameter is NULL, then a the status code\r
295 standard header is filled in with\r
296 gEfiStatusCodeSpecificDataGuid.\r
297 @param ExtendedData Pointer to the extended data buffer. This is an\r
298 optional parameter that may be NULL.\r
299 @param ExtendedDataSize The size, in bytes, of the extended data buffer.\r
300\r
301 @retval EFI_SUCCESS The status code was reported.\r
302 @retval EFI_OUT_OF_RESOURCES There were not enough resources to allocate\r
303 the extended data section if it was specified.\r
304 @retval EFI_UNSUPPORTED Report status code is not supported\r
305\r
306**/\r
307EFI_STATUS\r
308EFIAPI\r
309ReportStatusCodeEx (\r
310 IN EFI_STATUS_CODE_TYPE Type,\r
311 IN EFI_STATUS_CODE_VALUE Value,\r
312 IN UINT32 Instance,\r
313 IN CONST EFI_GUID *CallerId OPTIONAL,\r
314 IN CONST EFI_GUID *ExtendedDataGuid OPTIONAL,\r
315 IN CONST VOID *ExtendedData OPTIONAL,\r
316 IN UINTN ExtendedDataSize\r
317 )\r
318{\r
319 return EFI_SUCCESS;\r
320}\r
321\r
322\r
323/**\r
324 Returns TRUE if status codes of type EFI_PROGRESS_CODE are enabled\r
325\r
326 This function returns TRUE if the REPORT_STATUS_CODE_PROPERTY_PROGRESS_CODE_ENABLED\r
327 bit of PcdReportStatusCodeProperyMask is set. Otherwise FALSE is returned.\r
328\r
329 @retval TRUE The REPORT_STATUS_CODE_PROPERTY_PROGRESS_CODE_ENABLED bit of\r
330 PcdReportStatusCodeProperyMask is set.\r
331 @retval FALSE The REPORT_STATUS_CODE_PROPERTY_PROGRESS_CODE_ENABLED bit of\r
332 PcdReportStatusCodeProperyMask is clear.\r
333\r
334**/\r
335BOOLEAN\r
336EFIAPI\r
337ReportProgressCodeEnabled (\r
338 VOID\r
339 )\r
340{\r
341 return FALSE;\r
342}\r
343\r
344\r
345/**\r
346 Returns TRUE if status codes of type EFI_ERROR_CODE are enabled\r
347\r
348 This function returns TRUE if the REPORT_STATUS_CODE_PROPERTY_ERROR_CODE_ENABLED\r
349 bit of PcdReportStatusCodeProperyMask is set. Otherwise FALSE is returned.\r
350\r
351 @retval TRUE The REPORT_STATUS_CODE_PROPERTY_ERROR_CODE_ENABLED bit of\r
352 PcdReportStatusCodeProperyMask is set.\r
353 @retval FALSE The REPORT_STATUS_CODE_PROPERTY_ERROR_CODE_ENABLED bit of\r
354 PcdReportStatusCodeProperyMask is clear.\r
355\r
356**/\r
357BOOLEAN\r
358EFIAPI\r
359ReportErrorCodeEnabled (\r
360 VOID\r
361 )\r
362{\r
363 return FALSE;\r
364}\r
365\r
366\r
367/**\r
368 Returns TRUE if status codes of type EFI_DEBUG_CODE are enabled\r
369\r
370 This function returns TRUE if the REPORT_STATUS_CODE_PROPERTY_DEBUG_CODE_ENABLED\r
371 bit of PcdReportStatusCodeProperyMask is set. Otherwise FALSE is returned.\r
372\r
373 @retval TRUE The REPORT_STATUS_CODE_PROPERTY_DEBUG_CODE_ENABLED bit of\r
374 PcdReportStatusCodeProperyMask is set.\r
375 @retval FALSE The REPORT_STATUS_CODE_PROPERTY_DEBUG_CODE_ENABLED bit of\r
376 PcdReportStatusCodeProperyMask is clear.\r
377\r
378**/\r
379BOOLEAN\r
380EFIAPI\r
381ReportDebugCodeEnabled (\r
382 VOID\r
383 )\r
384{\r
385 return FALSE;\r
386}\r
387\r