aslmessages.c revision 1.1.1.20 1 /******************************************************************************
2 *
3 * Module Name: aslmessages.c - Compiler error/warning message strings
4 *
5 *****************************************************************************/
6
7 /*
8 * Copyright (C) 2000 - 2021, Intel Corp.
9 * All rights reserved.
10 *
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions
13 * are met:
14 * 1. Redistributions of source code must retain the above copyright
15 * notice, this list of conditions, and the following disclaimer,
16 * without modification.
17 * 2. Redistributions in binary form must reproduce at minimum a disclaimer
18 * substantially similar to the "NO WARRANTY" disclaimer below
19 * ("Disclaimer") and any redistribution must be conditioned upon
20 * including a substantially similar Disclaimer requirement for further
21 * binary redistribution.
22 * 3. Neither the names of the above-listed copyright holders nor the names
23 * of any contributors may be used to endorse or promote products derived
24 * from this software without specific prior written permission.
25 *
26 * Alternatively, this software may be distributed under the terms of the
27 * GNU General Public License ("GPL") version 2 as published by the Free
28 * Software Foundation.
29 *
30 * NO WARRANTY
31 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
32 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
33 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
34 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
35 * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
36 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
37 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
38 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
39 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
40 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
41 * POSSIBILITY OF SUCH DAMAGES.
42 */
43
44 #include "aslcompiler.h"
45
46 #define _COMPONENT ACPI_COMPILER
47 ACPI_MODULE_NAME ("aslmessages")
48
49
50 /*
51 * Strings for message reporting levels, must match error
52 * type string tables in aslmessages.c
53 */
54 const char *AslErrorLevel [ASL_NUM_REPORT_LEVELS] = {
55 "Optimize",
56 "Remark ",
57 "Warning ",
58 "Warning ",
59 "Warning ",
60 "Error "
61 };
62
63 /* All lowercase versions for IDEs */
64
65 const char *AslErrorLevelIde [ASL_NUM_REPORT_LEVELS] = {
66 "optimize",
67 "remark ",
68 "warning ",
69 "warning ",
70 "warning ",
71 "error "
72 };
73
74
75 /*
76 * Actual message strings for each compiler message ID. There are currently
77 * three distinct blocks of error messages (so that they can be expanded
78 * individually):
79 * Main ASL compiler
80 * Data Table compiler
81 * Preprocessor
82 *
83 * NOTE1: These tables must match the enum list of message IDs in the file
84 * aslmessages.h exactly.
85 *
86 * NOTE2: With the introduction of the -vw option to disable specific messages,
87 * new messages should only be added to the end of this list, so that values
88 * for existing messages are not disturbed.
89 */
90
91 /* ASL compiler */
92
93 const char *AslCompilerMsgs [] =
94 {
95 /* The zeroth message is reserved */ "",
96 /* ASL_MSG_ALIGNMENT */ "Must be a multiple of alignment/granularity value",
97 /* ASL_MSG_ALPHANUMERIC_STRING */ "String must be entirely alphanumeric",
98 /* ASL_MSG_AML_NOT_IMPLEMENTED */ "Opcode is not implemented in compiler AML code generator",
99 /* ASL_MSG_ARG_COUNT_HI */ "Too many arguments",
100 /* ASL_MSG_ARG_COUNT_LO */ "Too few arguments",
101 /* ASL_MSG_ARG_INIT */ "Method argument is not initialized",
102 /* ASL_MSG_BACKWARDS_OFFSET */ "Invalid backwards offset",
103 /* ASL_MSG_BUFFER_LENGTH */ "Effective AML buffer length is zero",
104 /* ASL_MSG_CLOSE */ "Could not close file",
105 /* ASL_MSG_COMPILER_INTERNAL */ "Internal compiler error",
106 /* ASL_MSG_COMPILER_RESERVED */ "Use of compiler reserved name",
107 /* ASL_MSG_CONNECTION_MISSING */ "A Connection operator is required for this field SpaceId",
108 /* ASL_MSG_CONNECTION_INVALID */ "Invalid OpRegion SpaceId for use of Connection operator",
109 /* ASL_MSG_CONSTANT_EVALUATION */ "Could not evaluate constant expression",
110 /* ASL_MSG_CONSTANT_FOLDED */ "Constant expression evaluated and reduced",
111 /* ASL_MSG_CORE_EXCEPTION */ "From ACPICA Subsystem",
112 /* ASL_MSG_DEBUG_FILE_OPEN */ "Could not open debug file",
113 /* ASL_MSG_DEBUG_FILENAME */ "Could not create debug filename",
114 /* ASL_MSG_DEPENDENT_NESTING */ "Dependent function macros cannot be nested",
115 /* ASL_MSG_DMA_CHANNEL */ "Invalid DMA channel (must be 0-7)",
116 /* ASL_MSG_DMA_LIST */ "Too many DMA channels (8 max)",
117 /* ASL_MSG_DUPLICATE_CASE */ "Case value already specified",
118 /* ASL_MSG_DUPLICATE_ITEM */ "Duplicate value in list",
119 /* ASL_MSG_EARLY_EOF */ "Premature end-of-file reached",
120 /* ASL_MSG_ENCODING_LENGTH */ "Package length too long to encode",
121 /* ASL_MSG_EX_INTERRUPT_LIST */ "Too many interrupts (255 max)",
122 /* ASL_MSG_EX_INTERRUPT_LIST_MIN */ "Too few interrupts (1 minimum required)",
123 /* ASL_MSG_EX_INTERRUPT_NUMBER */ "Invalid interrupt number (must be 32 bits)",
124 /* ASL_MSG_FIELD_ACCESS_WIDTH */ "Access width is greater than region size",
125 /* ASL_MSG_FIELD_UNIT_ACCESS_WIDTH */ "Access width of Field Unit extends beyond region limit",
126 /* ASL_MSG_FIELD_UNIT_OFFSET */ "Field Unit extends beyond region limit",
127 /* ASL_MSG_GPE_NAME_CONFLICT */ "Name conflicts with a previous GPE method",
128 /* ASL_MSG_HID_LENGTH */ "_HID string must be exactly 7 or 8 characters",
129 /* ASL_MSG_HID_PREFIX */ "_HID prefix must be all uppercase or decimal digits",
130 /* ASL_MSG_HID_SUFFIX */ "_HID suffix must be all hex digits",
131 /* ASL_MSG_INCLUDE_FILE_OPEN */ "Could not open include file",
132 /* ASL_MSG_INPUT_FILE_OPEN */ "Could not open input file",
133 /* ASL_MSG_INTEGER_LENGTH */ "Truncating 64-bit constant found in 32-bit table",
134 /* ASL_MSG_INTEGER_OPTIMIZATION */ "Integer optimized to single-byte AML opcode",
135 /* ASL_MSG_INTERRUPT_LIST */ "Too many interrupts (16 max)",
136 /* ASL_MSG_INTERRUPT_NUMBER */ "Invalid interrupt number (must be 0-15)",
137 /* ASL_MSG_INVALID_ACCESS_SIZE */ "Invalid AccessSize (Maximum is 4 - QWord access)",
138 /* ASL_MSG_INVALID_ADDR_FLAGS */ "Invalid combination of Length and Min/Max fixed flags",
139 /* ASL_MSG_INVALID_CONSTANT_OP */ "Invalid operator in constant expression (not type 3/4/5)",
140 /* ASL_MSG_INVALID_EISAID */ "EISAID string must be of the form \"UUUXXXX\" (3 uppercase, 4 hex digits)",
141 /* ASL_MSG_INVALID_ESCAPE */ "Invalid or unknown escape sequence",
142 /* ASL_MSG_INVALID_GRAN_FIXED */ "Granularity must be zero for fixed Min/Max",
143 /* ASL_MSG_INVALID_GRANULARITY */ "Granularity must be zero or a power of two minus one",
144 /* ASL_MSG_INVALID_LENGTH */ "Length is larger than Min/Max window",
145 /* ASL_MSG_INVALID_LENGTH_FIXED */ "Length is not equal to fixed Min/Max window",
146 /* ASL_MSG_INVALID_MIN_MAX */ "Address Min is greater than Address Max",
147 /* ASL_MSG_INVALID_OPERAND */ "Invalid operand",
148 /* ASL_MSG_INVALID_PERFORMANCE */ "Invalid performance/robustness value",
149 /* ASL_MSG_INVALID_PRIORITY */ "Invalid priority value",
150 /* ASL_MSG_INVALID_STRING */ "Invalid Hex/Octal Escape - Non-ASCII or NULL",
151 /* ASL_MSG_INVALID_TARGET */ "Target operand not allowed in constant expression",
152 /* ASL_MSG_INVALID_TIME */ "Time parameter too long (255 max)",
153 /* ASL_MSG_INVALID_TYPE */ "Invalid type",
154 /* ASL_MSG_INVALID_UUID */ "UUID string must be of the form \"aabbccdd-eeff-gghh-iijj-kkllmmnnoopp\"",
155 /* ASL_MSG_ISA_ADDRESS */ "Maximum 10-bit ISA address (0x3FF)",
156 /* ASL_MSG_LEADING_ASTERISK */ "Invalid leading asterisk",
157 /* ASL_MSG_LIST_LENGTH_LONG */ "Initializer list longer than declared package length",
158 /* ASL_MSG_LIST_LENGTH_SHORT */ "Initializer list shorter than declared package length",
159 /* ASL_MSG_LISTING_FILE_OPEN */ "Could not open listing file",
160 /* ASL_MSG_LISTING_FILENAME */ "Could not create listing filename",
161 /* ASL_MSG_LOCAL_INIT */ "Method local variable is not initialized",
162 /* ASL_MSG_LOCAL_OUTSIDE_METHOD */ "Local or Arg used outside a control method",
163 /* ASL_MSG_LONG_LINE */ "Splitting long input line",
164 /* ASL_MSG_MEMORY_ALLOCATION */ "Memory allocation failure",
165 /* ASL_MSG_MISSING_ENDDEPENDENT */ "Missing EndDependentFn() macro in dependent resource list",
166 /* ASL_MSG_MISSING_STARTDEPENDENT */ "Missing StartDependentFn() macro in dependent resource list",
167 /* ASL_MSG_MULTIPLE_DEFAULT */ "More than one Default statement within Switch construct",
168 /* ASL_MSG_MULTIPLE_TYPES */ "Multiple types",
169 /* ASL_MSG_NAME_EXISTS */ "Name already exists in scope",
170 /* ASL_MSG_NAME_OPTIMIZATION */ "NamePath optimized",
171 /* ASL_MSG_NAMED_OBJECT_IN_WHILE */ "Creating a named object in a While loop",
172 /* ASL_MSG_NESTED_COMMENT */ "Nested comment found",
173 /* ASL_MSG_NO_CASES */ "No Case statements under Switch",
174 /* ASL_MSG_NO_REGION */ "_REG has no corresponding Operation Region",
175 /* ASL_MSG_NO_RETVAL */ "Called method returns no value",
176 /* ASL_MSG_NO_WHILE */ "No enclosing While statement",
177 /* ASL_MSG_NON_ASCII */ "Invalid characters found in file",
178 /* ASL_MSG_BUFFER_FIELD_LENGTH */ "Field length must be non-zero",
179 /* ASL_MSG_NOT_EXIST */ "Object does not exist",
180 /* ASL_MSG_NOT_FOUND */ "Object not found or not accessible from current scope",
181 /* ASL_MSG_NOT_METHOD */ "Not a control method, cannot invoke",
182 /* ASL_MSG_NOT_PARAMETER */ "Not a parameter, used as local only",
183 /* ASL_MSG_NOT_REACHABLE */ "Object is not accessible from this scope",
184 /* ASL_MSG_NOT_REFERENCED */ "Object is not referenced",
185 /* ASL_MSG_NULL_DESCRIPTOR */ "Min/Max/Length/Gran are all zero, but no resource tag",
186 /* ASL_MSG_NULL_STRING */ "Invalid zero-length (null) string",
187 /* ASL_MSG_OPEN */ "Could not open file",
188 /* ASL_MSG_OUTPUT_FILE_OPEN */ "Could not open output AML file",
189 /* ASL_MSG_OUTPUT_FILENAME */ "Could not create output filename",
190 /* ASL_MSG_PACKAGE_LENGTH */ "Effective AML package length is zero",
191 /* ASL_MSG_PREPROCESSOR_FILENAME */ "Could not create preprocessor filename",
192 /* ASL_MSG_READ */ "Could not read file",
193 /* ASL_MSG_RECURSION */ "Recursive method call",
194 /* ASL_MSG_REGION_BUFFER_ACCESS */ "Host Operation Region requires BufferAcc access",
195 /* ASL_MSG_REGION_BYTE_ACCESS */ "Host Operation Region requires ByteAcc access",
196 /* ASL_MSG_RESERVED_ARG_COUNT_HI */ "Reserved method has too many arguments",
197 /* ASL_MSG_RESERVED_ARG_COUNT_LO */ "Reserved method has too few arguments",
198 /* ASL_MSG_RESERVED_METHOD */ "Reserved name must be a control method",
199 /* ASL_MSG_RESERVED_NO_RETURN_VAL */ "Reserved method should not return a value",
200 /* ASL_MSG_RESERVED_OPERAND_TYPE */ "Invalid object type for reserved name",
201 /* ASL_MSG_RESERVED_PACKAGE_LENGTH */ "Invalid package length for reserved name",
202 /* ASL_MSG_RESERVED_RETURN_VALUE */ "Reserved method must return a value",
203 /* ASL_MSG_RESERVED_USE */ "Invalid use of reserved name",
204 /* ASL_MSG_RESERVED_WORD */ "Use of reserved name",
205 /* ASL_MSG_RESOURCE_FIELD */ "Resource field name cannot be used as a target",
206 /* ASL_MSG_RESOURCE_INDEX */ "Missing ResourceSourceIndex (required)",
207 /* ASL_MSG_RESOURCE_LIST */ "Too many resource items (internal error)",
208 /* ASL_MSG_RESOURCE_SOURCE */ "Missing ResourceSource string (required)",
209 /* ASL_MSG_RESULT_NOT_USED */ "Result is not used, operator has no effect",
210 /* ASL_MSG_RETURN_TYPES */ "Not all control paths return a value",
211 /* ASL_MSG_SCOPE_FWD_REF */ "Forward references from Scope operator not allowed",
212 /* ASL_MSG_SCOPE_TYPE */ "Existing object has invalid type for Scope operator",
213 /* ASL_MSG_SEEK */ "Could not seek file",
214 /* ASL_MSG_SERIALIZED */ "Control Method marked Serialized",
215 /* ASL_MSG_SERIALIZED_REQUIRED */ "Control Method should be made Serialized due to creation of named objects within",
216 /* ASL_MSG_SINGLE_NAME_OPTIMIZATION */ "NamePath optimized to NameSeg (uses run-time search path)",
217 /* ASL_MSG_SOME_NO_RETVAL */ "Called method may not always return a value",
218 /* ASL_MSG_STRING_LENGTH */ "String literal too long",
219 /* ASL_MSG_SWITCH_TYPE */ "Switch expression is not a static Integer/Buffer/String data type, defaulting to Integer",
220 /* ASL_MSG_SYNC_LEVEL */ "SyncLevel must be in the range 0-15",
221 /* ASL_MSG_SYNTAX */ "",
222 /* ASL_MSG_TABLE_SIGNATURE */ "Invalid Table Signature",
223 /* ASL_MSG_TAG_LARGER */ "ResourceTag larger than Field",
224 /* ASL_MSG_TAG_SMALLER */ "ResourceTag smaller than Field",
225 /* ASL_MSG_TIMEOUT */ "Result is not used, possible operator timeout will be missed",
226 /* ASL_MSG_TOO_MANY_TEMPS */ "Method requires too many temporary variables (_T_x)",
227 /* ASL_MSG_TRUNCATION */ "64-bit return value will be truncated to 32 bits (DSDT or SSDT version < 2)",
228 /* ASL_MSG_UNKNOWN_RESERVED_NAME */ "Unknown reserved name",
229 /* ASL_MSG_UNREACHABLE_CODE */ "Statement is unreachable",
230 /* ASL_MSG_UNSUPPORTED */ "Unsupported feature",
231 /* ASL_MSG_UPPER_CASE */ "Non-hex letters must be upper case",
232 /* ASL_MSG_VENDOR_LIST */ "Too many vendor data bytes (7 max)",
233 /* ASL_MSG_WRITE */ "Could not write file",
234 /* ASL_MSG_RANGE */ "Constant out of range",
235 /* ASL_MSG_BUFFER_ALLOCATION */ "Could not allocate line buffer",
236 /* ASL_MSG_MISSING_DEPENDENCY */ "Missing dependency",
237 /* ASL_MSG_ILLEGAL_FORWARD_REF */ "Illegal forward reference",
238 /* ASL_MSG_ILLEGAL_METHOD_REF */ "Object is declared in a different method",
239 /* ASL_MSG_LOCAL_NOT_USED */ "Method Local is set but never used",
240 /* ASL_MSG_ARG_AS_LOCAL_NOT_USED */ "Method Argument (as a local) is set but never used",
241 /* ASL_MSG_ARG_NOT_USED */ "Method Argument is never used",
242 /* ASL_MSG_CONSTANT_REQUIRED */ "Non-reducible expression",
243 /* ASL_MSG_CROSS_TABLE_SCOPE */ "Illegal open scope on external object from within DSDT",
244 /* ASL_MSG_EXCEPTION_NOT_RECEIVED */ "Expected remark, warning, or error did not occur. Message ID:",
245 /* ASL_MSG_NULL_RESOURCE_TEMPLATE */ "Empty Resource Template (END_TAG only)",
246 /* ASL_MSG_FOUND_HERE */ "Original name creation/declaration below: ",
247 /* ASL_MSG_ILLEGAL_RECURSION */ "Illegal recursive call to method that creates named objects",
248 /* ASL_MSG_DUPLICATE_INPUT_FILE */ "Duplicate input files detected:",
249 /* ASL_MSG_WARNING_AS_ERROR */ "Warnings detected during compilation",
250 /* ASL_MSG_OEM_TABLE_ID */ "Invalid OEM Table ID",
251 /* ASL_MSG_OEM_ID */ "Invalid OEM ID",
252 /* ASL_MSG_UNLOAD */ "Unload is not supported by all operating systems",
253 /* ASL_MSG_OFFSET */ "Unnecessary/redundant use of Offset operator",
254 /* ASL_MSG_LONG_SLEEP */ "Very long Sleep, greater than 1 second",
255 /* ASL_MSG_PREFIX_NOT_EXIST */ "One or more prefix Scopes do not exist",
256 /* ASL_MSG_NAMEPATH_NOT_EXIST */ "One or more objects within the Pathname do not exist",
257 /* ASL_MSG_REGION_LENGTH */ "Operation Region declared with zero length",
258 /* ASL_MSG_TEMPORARY_OBJECT */ "Object is created temporarily in another method and cannot be accessed",
259 /* ASL_MSG_UNDEFINED_EXTERNAL */ "Named object was declared external but the actual definition does not exist",
260 /* ASL_MSG_BUFFER_FIELD_OVERFLOW */ "Buffer field extends beyond end of target buffer",
261 /* ASL_MSG_INVALID_SPECIAL_NAME */ "declaration of this named object outside root scope is illegal",
262 /* ASL_MSG_INVALID_PROCESSOR_UID */ "_UID inside processor declaration must be an integer",
263 /* ASL_MSG_LEGACY_PROCESSOR_OP */ "Legacy Processor() keyword detected. Use Device() keyword instead.",
264 /* ASL_MSG_NAMESTRING_LENGTH */ "NameString contains too many NameSegs (>255)",
265 /* ASL_MSG_CASE_FOUND_HERE */ "Original Case value below:",
266 /* ASL_MSG_EXTERN_INVALID_RET_TYPE */ "Return type is only allowed for Externals declared as MethodObj",
267 /* ASL_MSG_EXTERN_INVALID_PARAM_TYPE */ "Parameter type is only allowed for Externals declared as MethodObj",
268 /* ASL_MSG_NAMED_OBJECT_CREATION */ "Creation of named objects within a method is highly inefficient, use globals or method local variables instead",
269 /* ASL_MSG_ARG_COUNT_MISMATCH */ "Method NumArgs count does not match length of ParameterTypes list",
270 /* ASL_MSG_STATIC_OPREGION_IN_METHOD */ "Static OperationRegion should be declared outside control method",
271 /* ASL_MSG_DECLARATION_TYPE_MISMATCH */ "Type mismatch between external declaration and actual object declaration detected",
272 /* ASL_MSG_TYPE_MISMATCH_FOUND_HERE */ "Actual object declaration:",
273 /* ASL_MSG_DUPLICATE_EXTERN_MISMATCH */ "Type mismatch between multiple external declarations detected",
274 /* ASL_MSG_DUPLICATE_EXTERN_FOUND_HERE */"Duplicate external declaration:",
275 /* ASL_MSG_CONDREF_NEEDS_EXTERNAL_DECL */"CondRefOf parameter requires External() declaration",
276 /* ASL_MSG_EXTERNAL_FOUND_HERE */ "External declaration below ",
277 /* ASL_MSG_LOWER_CASE_NAMESEG */ "At least one lower case letter found in NameSeg, ASL is case insensitive - converting to upper case",
278 /* ASL_MSG_LOWER_CASE_NAMEPATH */ "At least one lower case letter found in NamePath, ASL is case insensitive - converting to upper case",
279 /* ASL_MSG_UUID_NOT_FOUND */ "Unknown UUID string",
280 /* ASL_MSG_LEGACY_DDB_TYPE */ "DDBHandleObj has been deprecated along with the Unload operator. DDBHandlObj objects are only used in Unload"
281 };
282
283 /* Table compiler */
284
285 const char *AslTableCompilerMsgs [] =
286 {
287 /* ASL_MSG_BUFFER_ELEMENT */ "Invalid element in buffer initializer list",
288 /* ASL_MSG_DIVIDE_BY_ZERO */ "Expression contains divide-by-zero",
289 /* ASL_MSG_FLAG_VALUE */ "Flag value is too large",
290 /* ASL_MSG_INTEGER_SIZE */ "Integer too large for target",
291 /* ASL_MSG_INVALID_EXPRESSION */ "Invalid expression",
292 /* ASL_MSG_INVALID_FIELD_NAME */ "Invalid Field Name",
293 /* ASL_MSG_INVALID_HEX_INTEGER */ "Invalid hex integer constant",
294 /* ASL_MSG_OEM_TABLE */ "OEM table - unknown contents",
295 /* ASL_MSG_RESERVED_FIELD */ "Reserved field",
296 /* ASL_MSG_UNKNOWN_LABEL */ "Label is undefined",
297 /* ASL_MSG_UNKNOWN_SUBTABLE */ "Unknown subtable type",
298 /* ASL_MSG_UNKNOWN_TABLE */ "Unknown ACPI table signature",
299 /* ASL_MSG_ZERO_VALUE */ "Value must be non-zero",
300 /* ASL_MSG_INVALID_LABEL */ "Invalid field label detected",
301 /* ASL_MSG_BUFFER_LIST */ "Invalid buffer initializer list",
302 /* ASL_MSG_ENTRY_LIST */ "Invalid entry initializer list",
303 /* ASL_MSG_UNKNOWN_FORMAT */ "Unknown format value",
304 /* ASL_MSG_RESERVED_VALUE */ "Value for field is reserved or unknown",
305 };
306
307 /* Preprocessor */
308
309 const char *AslPreprocessorMsgs [] =
310 {
311 /* ASL_MSG_DIRECTIVE_SYNTAX */ "Invalid directive syntax",
312 /* ASL_MSG_ENDIF_MISMATCH */ "Mismatched #endif",
313 /* ASL_MSG_ERROR_DIRECTIVE */ "#error",
314 /* ASL_MSG_EXISTING_NAME */ "Name is already defined",
315 /* ASL_MSG_INVALID_INVOCATION */ "Invalid macro invocation",
316 /* ASL_MSG_MACRO_SYNTAX */ "Invalid macro syntax",
317 /* ASL_MSG_TOO_MANY_ARGUMENTS */ "Too many macro arguments",
318 /* ASL_MSG_UNKNOWN_DIRECTIVE */ "Unknown directive",
319 /* ASL_MSG_UNKNOWN_PRAGMA */ "Unknown pragma",
320 /* ASL_MSG_WARNING_DIRECTIVE */ "#warning",
321 /* ASL_MSG_INCLUDE_FILE */ "Found a # preprocessor directive in ASL Include() file"
322 };
323
324
325 /*******************************************************************************
326 *
327 * FUNCTION: AeDecodeMessageId
328 *
329 * PARAMETERS: MessageId - ASL message ID (exception code) to be
330 * formatted. Possibly fully encoded.
331 *
332 * RETURN: A string containing the exception message text.
333 *
334 * DESCRIPTION: This function validates and translates an ASL message ID into
335 * an ASCII string.
336 *
337 ******************************************************************************/
338
339 const char *
340 AeDecodeMessageId (
341 UINT16 MessageId)
342 {
343 UINT32 Index;
344 const char **MessageTable;
345
346
347 /* Main ASL Compiler messages */
348
349 if (MessageId <= ASL_MSG_MAIN_COMPILER_END)
350 {
351 MessageTable = AslCompilerMsgs;
352 Index = MessageId;
353
354 if (Index >= ACPI_ARRAY_LENGTH (AslCompilerMsgs))
355 {
356 return ("[Unknown iASL Compiler exception ID]");
357 }
358 }
359
360 /* Data Table Compiler messages */
361
362 else if (MessageId <= ASL_MSG_TABLE_COMPILER_END)
363 {
364 MessageTable = AslTableCompilerMsgs;
365 Index = MessageId - ASL_MSG_TABLE_COMPILER;
366
367 if (Index >= ACPI_ARRAY_LENGTH (AslTableCompilerMsgs))
368 {
369 return ("[Unknown iASL Table Compiler exception ID]");
370 }
371 }
372
373 /* Preprocessor messages */
374
375 else if (MessageId <= ASL_MSG_PREPROCESSOR_END)
376 {
377 MessageTable = AslPreprocessorMsgs;
378 Index = MessageId - ASL_MSG_PREPROCESSOR;
379
380 if (Index >= ACPI_ARRAY_LENGTH (AslPreprocessorMsgs))
381 {
382 return ("[Unknown iASL Preprocessor exception ID]");
383 }
384 }
385
386 /* Everything else is unknown */
387
388 else
389 {
390 return ("[Unknown iASL exception ID]");
391 }
392
393 return (MessageTable[Index]);
394 }
395
396
397 /*******************************************************************************
398 *
399 * FUNCTION: AeDecodeExceptionLevel
400 *
401 * PARAMETERS: Level - The ASL error level to be decoded
402 *
403 * RETURN: A string containing the error level text
404 *
405 * DESCRIPTION: This function validates and translates an ASL error level into
406 * an ASCII string.
407 *
408 ******************************************************************************/
409
410 const char *
411 AeDecodeExceptionLevel (
412 UINT8 Level)
413 {
414 /* Range check on Level */
415
416 if (Level >= ACPI_ARRAY_LENGTH (AslErrorLevel))
417 {
418 return ("Unknown exception level");
419 }
420
421 /* Differentiate the string type to be used (IDE is all lower case) */
422
423 if (AslGbl_VerboseErrors)
424 {
425 return (AslErrorLevel[Level]);
426 }
427
428 return (AslErrorLevelIde[Level]);
429 }
430
431
432 /*******************************************************************************
433 *
434 * FUNCTION: AeBuildFullExceptionCode
435 *
436 * PARAMETERS: Level - ASL error level
437 * MessageId - ASL exception code to be formatted
438 *
439 * RETURN: Fully encoded exception code
440 *
441 * DESCRIPTION: Build the full exception code from the error level and the
442 * actual message ID.
443 *
444 ******************************************************************************/
445
446 UINT16
447 AeBuildFullExceptionCode (
448 UINT8 Level,
449 UINT16 MessageId)
450 {
451
452 /*
453 * Error level is in the thousands slot (error/warning/remark, etc.)
454 * Error codes are 0 - 999
455 */
456 return (((Level + 1) * 1000) + MessageId);
457 }
458
459
460 #ifdef ACPI_HELP_APP
461 /*******************************************************************************
462 *
463 * FUNCTION: AhDecodeAslException
464 *
465 * PARAMETERS: HexString - iASL status string from command line, in
466 * hex. If null, display all exceptions.
467 *
468 * RETURN: None
469 *
470 * DESCRIPTION: Decode and display an iASL exception code. Note1: a
471 * NULL string for HexString displays all known iASL exceptions. Note2:
472 * implements the -x option for AcpiHelp.
473 *
474 ******************************************************************************/
475
476 #define AH_DISPLAY_ASL_EXCEPTION_TEXT(Status, Exception) \
477 printf ("%.4X: %s\n", Status, Exception)
478
479 #define AH_DISPLAY_EXCEPTION(Status, Name) \
480 printf ("%.4X: %s\n", Status, Name)
481
482
483 void
484 AhDecodeAslException (
485 char *HexString)
486 {
487 UINT32 i;
488 UINT32 MessageId;
489 const char *OneException;
490 UINT32 Index = 1;
491
492
493 /*
494 * A null input string means to decode and display all known
495 * exception codes.
496 */
497 if (!HexString)
498 {
499 printf ("All defined iASL exception codes:\n\n");
500 printf ("Main iASL exceptions:\n\n");
501 AH_DISPLAY_EXCEPTION (0,
502 "AE_OK (No error occurred)");
503
504 /* Display codes in each block of exception types */
505
506 for (i = 1; Index < ACPI_ARRAY_LENGTH (AslCompilerMsgs); i++, Index++)
507 {
508 AH_DISPLAY_ASL_EXCEPTION_TEXT (Index, AslCompilerMsgs[i]);
509 }
510
511 printf ("\niASL Table Compiler exceptions:\n\n");
512 Index = ASL_MSG_TABLE_COMPILER;
513 for (i = 0; i < ACPI_ARRAY_LENGTH (AslTableCompilerMsgs); i++, Index++)
514 {
515 AH_DISPLAY_ASL_EXCEPTION_TEXT (Index, AslTableCompilerMsgs[i]);
516 }
517
518 printf ("\niASL Preprocessor exceptions:\n\n");
519 Index = ASL_MSG_PREPROCESSOR;
520 for (i = 0; i < ACPI_ARRAY_LENGTH (AslPreprocessorMsgs); i++, Index++)
521 {
522 AH_DISPLAY_ASL_EXCEPTION_TEXT (Index, AslPreprocessorMsgs[i]);
523 }
524 return;
525 }
526
527 /* HexString is valid - convert it to a MessageId and decode it */
528
529 MessageId = strtol (HexString, NULL, 16);
530 OneException = AeDecodeMessageId ((UINT16) MessageId);
531 AH_DISPLAY_ASL_EXCEPTION_TEXT (MessageId, OneException);
532 }
533 #endif
534