1 /** @file
2 Defines and prototypes for common EFI utility error and debug messages.
3 
4 Copyright (c) 2004 - 2018, Intel Corporation. All rights reserved.<BR>
5 SPDX-License-Identifier: BSD-2-Clause-Patent
6 
7 **/
8 
9 #ifndef _EFI_UTILITY_MSGS_H_
10 #define _EFI_UTILITY_MSGS_H_
11 
12 #include <Common/UefiBaseTypes.h>
13 
14 //
15 // Log message print Level
16 //
17 #define VERBOSE_LOG_LEVEL    15
18 #define WARNING_LOG_LEVEL    15
19 #define INFO_LOG_LEVEL       20
20 #define KEY_LOG_LEVEL        40
21 #define ERROR_LOG_LEVLE      50
22 
23 //
24 // Status codes returned by EFI utility programs and functions
25 //
26 #define STATUS_SUCCESS  0
27 #define STATUS_WARNING  1
28 #define STATUS_ERROR    2
29 #define VOID void
30 
31 typedef int STATUS;
32 
33 #define MAX_LINE_LEN               0x200
34 #define MAXIMUM_INPUT_FILE_NUM     10
35 
36 #ifdef __cplusplus
37 extern "C" {
38 #endif
39 //
40 // When we call Error() or Warning(), the module keeps track of the worst
41 // case reported. GetUtilityStatus() will get the worst-case results, which
42 // can be used as the return value from the app.
43 //
44 STATUS
45 GetUtilityStatus (
46   VOID
47   );
48 
49 //
50 // If someone prints an error message and didn't specify a source file name,
51 // then we print the utility name instead. However they must tell us the
52 // utility name early on via this function.
53 //
54 VOID
55 SetUtilityName (
56   CHAR8 *ProgramName
57   )
58 ;
59 
60 VOID
61 PrintMessage (
62   CHAR8   *Type,
63   CHAR8   *FileName,
64   UINT32  LineNumber,
65   UINT32  MessageCode,
66   CHAR8   *Text,
67   CHAR8   *MsgFmt,
68   va_list List
69   );
70 
71 VOID
72 Error (
73   CHAR8   *FileName,
74   UINT32  LineNumber,
75   UINT32  ErrorCode,
76   CHAR8   *OffendingText,
77   CHAR8   *MsgFmt,
78   ...
79   )
80 ;
81 
82 VOID
83 Warning (
84   CHAR8   *FileName,
85   UINT32  LineNumber,
86   UINT32  WarningCode,
87   CHAR8   *OffendingText,
88   CHAR8   *MsgFmt,
89   ...
90   )
91 ;
92 
93 VOID
94 DebugMsg (
95   CHAR8   *FileName,
96   UINT32  LineNumber,
97   UINT64  MsgLevel,
98   CHAR8   *OffendingText,
99   CHAR8   *MsgFmt,
100   ...
101   )
102 ;
103 
104 VOID
105 VerboseMsg (
106   CHAR8   *MsgFmt,
107   ...
108   );
109 
110 VOID
111 NormalMsg (
112   CHAR8   *MsgFmt,
113   ...
114   );
115 
116 VOID
117 KeyMsg (
118   CHAR8   *MsgFmt,
119   ...
120   );
121 
122 VOID
123 SetPrintLevel (
124   UINT64  LogLevel
125   );
126 
127 VOID
128 ParserSetPosition (
129   CHAR8   *SourceFileName,
130   UINT32  LineNum
131   )
132 ;
133 
134 VOID
135 ParserError (
136   UINT32  ErrorCode,
137   CHAR8   *OffendingText,
138   CHAR8   *MsgFmt,
139   ...
140   )
141 ;
142 
143 VOID
144 ParserWarning (
145   UINT32  ErrorCode,
146   CHAR8   *OffendingText,
147   CHAR8   *MsgFmt,
148   ...
149   )
150 ;
151 
152 VOID
153 SetPrintLimits (
154   UINT32  NumErrors,
155   UINT32  NumWarnings,
156   UINT32  NumWarningsPlusErrors
157   )
158 ;
159 
160 #ifdef __cplusplus
161 }
162 #endif
163 
164 #endif // #ifndef _EFI_UTILITY_MSGS_H_
165