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