1264919Sjkim/******************************************************************************
2264919Sjkim *
3264919Sjkim * Module Name: aslmessages.c - Compiler error/warning message strings
4264919Sjkim *
5264919Sjkim *****************************************************************************/
6264919Sjkim
7264919Sjkim/*
8306536Sjkim * Copyright (C) 2000 - 2016, Intel Corp.
9264919Sjkim * All rights reserved.
10264919Sjkim *
11264919Sjkim * Redistribution and use in source and binary forms, with or without
12264919Sjkim * modification, are permitted provided that the following conditions
13264919Sjkim * are met:
14264919Sjkim * 1. Redistributions of source code must retain the above copyright
15264919Sjkim *    notice, this list of conditions, and the following disclaimer,
16264919Sjkim *    without modification.
17264919Sjkim * 2. Redistributions in binary form must reproduce at minimum a disclaimer
18264919Sjkim *    substantially similar to the "NO WARRANTY" disclaimer below
19264919Sjkim *    ("Disclaimer") and any redistribution must be conditioned upon
20264919Sjkim *    including a substantially similar Disclaimer requirement for further
21264919Sjkim *    binary redistribution.
22264919Sjkim * 3. Neither the names of the above-listed copyright holders nor the names
23264919Sjkim *    of any contributors may be used to endorse or promote products derived
24264919Sjkim *    from this software without specific prior written permission.
25264919Sjkim *
26264919Sjkim * Alternatively, this software may be distributed under the terms of the
27264919Sjkim * GNU General Public License ("GPL") version 2 as published by the Free
28264919Sjkim * Software Foundation.
29264919Sjkim *
30264919Sjkim * NO WARRANTY
31264919Sjkim * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
32264919Sjkim * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
33264919Sjkim * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
34264919Sjkim * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
35264919Sjkim * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
36264919Sjkim * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
37264919Sjkim * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
38264919Sjkim * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
39264919Sjkim * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
40264919Sjkim * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
41264919Sjkim * POSSIBILITY OF SUCH DAMAGES.
42264919Sjkim */
43264919Sjkim
44272444Sjkim#include <contrib/dev/acpica/compiler/aslcompiler.h>
45264919Sjkim
46264919Sjkim#define _COMPONENT          ACPI_COMPILER
47264919Sjkim        ACPI_MODULE_NAME    ("aslmessages")
48264919Sjkim
49264919Sjkim
50264919Sjkim/*
51264919Sjkim * Strings for message reporting levels, must match error
52264919Sjkim * type string tables in aslmessages.c
53264919Sjkim */
54264919Sjkimconst char              *AslErrorLevel [ASL_NUM_REPORT_LEVELS] = {
55264919Sjkim    "Optimize",
56264919Sjkim    "Remark  ",
57264919Sjkim    "Warning ",
58264919Sjkim    "Warning ",
59264919Sjkim    "Warning ",
60264919Sjkim    "Error   "
61264919Sjkim};
62264919Sjkim
63264919Sjkim/* All lowercase versions for IDEs */
64264919Sjkim
65264919Sjkimconst char              *AslErrorLevelIde [ASL_NUM_REPORT_LEVELS] = {
66264919Sjkim    "optimize",
67264919Sjkim    "remark  ",
68264919Sjkim    "warning ",
69264919Sjkim    "warning ",
70264919Sjkim    "warning ",
71264919Sjkim    "error   "
72264919Sjkim};
73264919Sjkim
74264919Sjkim
75264919Sjkim/*
76264919Sjkim * Actual message strings for each compiler message ID. There are currently
77264919Sjkim * three distinct blocks of error messages (so that they can be expanded
78264919Sjkim * individually):
79264919Sjkim *      Main ASL compiler
80264919Sjkim *      Data Table compiler
81264919Sjkim *      Preprocessor
82264919Sjkim *
83264919Sjkim * NOTE1: These tables must match the enum list of message IDs in the file
84264919Sjkim * aslmessages.h exactly.
85264919Sjkim *
86264919Sjkim * NOTE2: With the introduction of the -vw option to disable specific messages,
87264919Sjkim * new messages should only be added to the end of this list, so that values
88264919Sjkim * for existing messages are not disturbed.
89264919Sjkim */
90264919Sjkim
91264919Sjkim/* ASL compiler */
92264919Sjkim
93264919Sjkimconst char                      *AslCompilerMsgs [] =
94264919Sjkim{
95264919Sjkim/*    The zeroth message is reserved */    "",
96264919Sjkim/*    ASL_MSG_ALIGNMENT */                  "Must be a multiple of alignment/granularity value",
97264919Sjkim/*    ASL_MSG_ALPHANUMERIC_STRING */        "String must be entirely alphanumeric",
98264919Sjkim/*    ASL_MSG_AML_NOT_IMPLEMENTED */        "Opcode is not implemented in compiler AML code generator",
99264919Sjkim/*    ASL_MSG_ARG_COUNT_HI */               "Too many arguments",
100264919Sjkim/*    ASL_MSG_ARG_COUNT_LO */               "Too few arguments",
101264919Sjkim/*    ASL_MSG_ARG_INIT */                   "Method argument is not initialized",
102264919Sjkim/*    ASL_MSG_BACKWARDS_OFFSET */           "Invalid backwards offset",
103264919Sjkim/*    ASL_MSG_BUFFER_LENGTH */              "Effective AML buffer length is zero",
104264919Sjkim/*    ASL_MSG_CLOSE */                      "Could not close file",
105264919Sjkim/*    ASL_MSG_COMPILER_INTERNAL */          "Internal compiler error",
106264919Sjkim/*    ASL_MSG_COMPILER_RESERVED */          "Use of compiler reserved name",
107264919Sjkim/*    ASL_MSG_CONNECTION_MISSING */         "A Connection operator is required for this field SpaceId",
108264919Sjkim/*    ASL_MSG_CONNECTION_INVALID */         "Invalid OpRegion SpaceId for use of Connection operator",
109264919Sjkim/*    ASL_MSG_CONSTANT_EVALUATION */        "Could not evaluate constant expression",
110264919Sjkim/*    ASL_MSG_CONSTANT_FOLDED */            "Constant expression evaluated and reduced",
111264919Sjkim/*    ASL_MSG_CORE_EXCEPTION */             "From ACPICA Subsystem",
112264919Sjkim/*    ASL_MSG_DEBUG_FILE_OPEN */            "Could not open debug file",
113264919Sjkim/*    ASL_MSG_DEBUG_FILENAME */             "Could not create debug filename",
114264919Sjkim/*    ASL_MSG_DEPENDENT_NESTING */          "Dependent function macros cannot be nested",
115264919Sjkim/*    ASL_MSG_DMA_CHANNEL */                "Invalid DMA channel (must be 0-7)",
116264919Sjkim/*    ASL_MSG_DMA_LIST */                   "Too many DMA channels (8 max)",
117264919Sjkim/*    ASL_MSG_DUPLICATE_CASE */             "Case value already specified",
118264919Sjkim/*    ASL_MSG_DUPLICATE_ITEM */             "Duplicate value in list",
119264919Sjkim/*    ASL_MSG_EARLY_EOF */                  "Premature end-of-file reached",
120264919Sjkim/*    ASL_MSG_ENCODING_LENGTH */            "Package length too long to encode",
121264919Sjkim/*    ASL_MSG_EX_INTERRUPT_LIST */          "Too many interrupts (255 max)",
122264919Sjkim/*    ASL_MSG_EX_INTERRUPT_LIST_MIN */      "Too few interrupts (1 minimum required)",
123264919Sjkim/*    ASL_MSG_EX_INTERRUPT_NUMBER */        "Invalid interrupt number (must be 32 bits)",
124264919Sjkim/*    ASL_MSG_FIELD_ACCESS_WIDTH */         "Access width is greater than region size",
125264919Sjkim/*    ASL_MSG_FIELD_UNIT_ACCESS_WIDTH */    "Access width of Field Unit extends beyond region limit",
126264919Sjkim/*    ASL_MSG_FIELD_UNIT_OFFSET */          "Field Unit extends beyond region limit",
127264919Sjkim/*    ASL_MSG_GPE_NAME_CONFLICT */          "Name conflicts with a previous GPE method",
128264919Sjkim/*    ASL_MSG_HID_LENGTH */                 "_HID string must be exactly 7 or 8 characters",
129264919Sjkim/*    ASL_MSG_HID_PREFIX */                 "_HID prefix must be all uppercase or decimal digits",
130264919Sjkim/*    ASL_MSG_HID_SUFFIX */                 "_HID suffix must be all hex digits",
131264919Sjkim/*    ASL_MSG_INCLUDE_FILE_OPEN */          "Could not open include file",
132264919Sjkim/*    ASL_MSG_INPUT_FILE_OPEN */            "Could not open input file",
133306536Sjkim/*    ASL_MSG_INTEGER_LENGTH */             "64-bit integer in 32-bit table, truncating (DSDT or SSDT version < 2)",
134264919Sjkim/*    ASL_MSG_INTEGER_OPTIMIZATION */       "Integer optimized to single-byte AML opcode",
135264919Sjkim/*    ASL_MSG_INTERRUPT_LIST */             "Too many interrupts (16 max)",
136264919Sjkim/*    ASL_MSG_INTERRUPT_NUMBER */           "Invalid interrupt number (must be 0-15)",
137264919Sjkim/*    ASL_MSG_INVALID_ACCESS_SIZE */        "Invalid AccessSize (Maximum is 4 - QWord access)",
138264919Sjkim/*    ASL_MSG_INVALID_ADDR_FLAGS */         "Invalid combination of Length and Min/Max fixed flags",
139264919Sjkim/*    ASL_MSG_INVALID_CONSTANT_OP */        "Invalid operator in constant expression (not type 3/4/5)",
140264919Sjkim/*    ASL_MSG_INVALID_EISAID */             "EISAID string must be of the form \"UUUXXXX\" (3 uppercase, 4 hex digits)",
141264919Sjkim/*    ASL_MSG_INVALID_ESCAPE */             "Invalid or unknown escape sequence",
142264919Sjkim/*    ASL_MSG_INVALID_GRAN_FIXED */         "Granularity must be zero for fixed Min/Max",
143264919Sjkim/*    ASL_MSG_INVALID_GRANULARITY */        "Granularity must be zero or a power of two minus one",
144264919Sjkim/*    ASL_MSG_INVALID_LENGTH */             "Length is larger than Min/Max window",
145264919Sjkim/*    ASL_MSG_INVALID_LENGTH_FIXED */       "Length is not equal to fixed Min/Max window",
146264919Sjkim/*    ASL_MSG_INVALID_MIN_MAX */            "Address Min is greater than Address Max",
147264919Sjkim/*    ASL_MSG_INVALID_OPERAND */            "Invalid operand",
148264919Sjkim/*    ASL_MSG_INVALID_PERFORMANCE */        "Invalid performance/robustness value",
149264919Sjkim/*    ASL_MSG_INVALID_PRIORITY */           "Invalid priority value",
150264919Sjkim/*    ASL_MSG_INVALID_STRING */             "Invalid Hex/Octal Escape - Non-ASCII or NULL",
151264919Sjkim/*    ASL_MSG_INVALID_TARGET */             "Target operand not allowed in constant expression",
152264919Sjkim/*    ASL_MSG_INVALID_TIME */               "Time parameter too long (255 max)",
153264919Sjkim/*    ASL_MSG_INVALID_TYPE */               "Invalid type",
154264919Sjkim/*    ASL_MSG_INVALID_UUID */               "UUID string must be of the form \"aabbccdd-eeff-gghh-iijj-kkllmmnnoopp\"",
155264919Sjkim/*    ASL_MSG_ISA_ADDRESS */                "Maximum 10-bit ISA address (0x3FF)",
156264919Sjkim/*    ASL_MSG_LEADING_ASTERISK */           "Invalid leading asterisk",
157264919Sjkim/*    ASL_MSG_LIST_LENGTH_LONG */           "Initializer list longer than declared package length",
158264919Sjkim/*    ASL_MSG_LIST_LENGTH_SHORT */          "Initializer list shorter than declared package length",
159264919Sjkim/*    ASL_MSG_LISTING_FILE_OPEN */          "Could not open listing file",
160264919Sjkim/*    ASL_MSG_LISTING_FILENAME */           "Could not create listing filename",
161264919Sjkim/*    ASL_MSG_LOCAL_INIT */                 "Method local variable is not initialized",
162264919Sjkim/*    ASL_MSG_LOCAL_OUTSIDE_METHOD */       "Local or Arg used outside a control method",
163264919Sjkim/*    ASL_MSG_LONG_LINE */                  "Splitting long input line",
164264919Sjkim/*    ASL_MSG_MEMORY_ALLOCATION */          "Memory allocation failure",
165264919Sjkim/*    ASL_MSG_MISSING_ENDDEPENDENT */       "Missing EndDependentFn() macro in dependent resource list",
166264919Sjkim/*    ASL_MSG_MISSING_STARTDEPENDENT */     "Missing StartDependentFn() macro in dependent resource list",
167264919Sjkim/*    ASL_MSG_MULTIPLE_DEFAULT */           "More than one Default statement within Switch construct",
168264919Sjkim/*    ASL_MSG_MULTIPLE_TYPES */             "Multiple types",
169264919Sjkim/*    ASL_MSG_NAME_EXISTS */                "Name already exists in scope",
170264919Sjkim/*    ASL_MSG_NAME_OPTIMIZATION */          "NamePath optimized",
171264919Sjkim/*    ASL_MSG_NAMED_OBJECT_IN_WHILE */      "Creating a named object in a While loop",
172264919Sjkim/*    ASL_MSG_NESTED_COMMENT */             "Nested comment found",
173264919Sjkim/*    ASL_MSG_NO_CASES */                   "No Case statements under Switch",
174264919Sjkim/*    ASL_MSG_NO_REGION */                  "_REG has no corresponding Operation Region",
175264919Sjkim/*    ASL_MSG_NO_RETVAL */                  "Called method returns no value",
176264919Sjkim/*    ASL_MSG_NO_WHILE */                   "No enclosing While statement",
177264919Sjkim/*    ASL_MSG_NON_ASCII */                  "Invalid characters found in file",
178264919Sjkim/*    ASL_MSG_NON_ZERO */                   "Operand evaluates to zero",
179264919Sjkim/*    ASL_MSG_NOT_EXIST */                  "Object does not exist",
180264919Sjkim/*    ASL_MSG_NOT_FOUND */                  "Object not found or not accessible from scope",
181264919Sjkim/*    ASL_MSG_NOT_METHOD */                 "Not a control method, cannot invoke",
182264919Sjkim/*    ASL_MSG_NOT_PARAMETER */              "Not a parameter, used as local only",
183264919Sjkim/*    ASL_MSG_NOT_REACHABLE */              "Object is not accessible from this scope",
184264919Sjkim/*    ASL_MSG_NOT_REFERENCED */             "Object is not referenced",
185264919Sjkim/*    ASL_MSG_NULL_DESCRIPTOR */            "Min/Max/Length/Gran are all zero, but no resource tag",
186264919Sjkim/*    ASL_MSG_NULL_STRING */                "Invalid zero-length (null) string",
187264919Sjkim/*    ASL_MSG_OPEN */                       "Could not open file",
188264919Sjkim/*    ASL_MSG_OUTPUT_FILE_OPEN */           "Could not open output AML file",
189264919Sjkim/*    ASL_MSG_OUTPUT_FILENAME */            "Could not create output filename",
190264919Sjkim/*    ASL_MSG_PACKAGE_LENGTH */             "Effective AML package length is zero",
191264919Sjkim/*    ASL_MSG_PREPROCESSOR_FILENAME */      "Could not create preprocessor filename",
192264919Sjkim/*    ASL_MSG_READ */                       "Could not read file",
193264919Sjkim/*    ASL_MSG_RECURSION */                  "Recursive method call",
194264919Sjkim/*    ASL_MSG_REGION_BUFFER_ACCESS */       "Host Operation Region requires BufferAcc access",
195264919Sjkim/*    ASL_MSG_REGION_BYTE_ACCESS */         "Host Operation Region requires ByteAcc access",
196264919Sjkim/*    ASL_MSG_RESERVED_ARG_COUNT_HI */      "Reserved method has too many arguments",
197264919Sjkim/*    ASL_MSG_RESERVED_ARG_COUNT_LO */      "Reserved method has too few arguments",
198264919Sjkim/*    ASL_MSG_RESERVED_METHOD */            "Reserved name must be a control method",
199264919Sjkim/*    ASL_MSG_RESERVED_NO_RETURN_VAL */     "Reserved method should not return a value",
200264919Sjkim/*    ASL_MSG_RESERVED_OPERAND_TYPE */      "Invalid object type for reserved name",
201264919Sjkim/*    ASL_MSG_RESERVED_PACKAGE_LENGTH */    "Invalid package length for reserved name",
202264919Sjkim/*    ASL_MSG_RESERVED_RETURN_VALUE */      "Reserved method must return a value",
203264919Sjkim/*    ASL_MSG_RESERVED_USE */               "Invalid use of reserved name",
204264919Sjkim/*    ASL_MSG_RESERVED_WORD */              "Use of reserved name",
205264919Sjkim/*    ASL_MSG_RESOURCE_FIELD */             "Resource field name cannot be used as a target",
206264919Sjkim/*    ASL_MSG_RESOURCE_INDEX */             "Missing ResourceSourceIndex (required)",
207264919Sjkim/*    ASL_MSG_RESOURCE_LIST */              "Too many resource items (internal error)",
208264919Sjkim/*    ASL_MSG_RESOURCE_SOURCE */            "Missing ResourceSource string (required)",
209264919Sjkim/*    ASL_MSG_RESULT_NOT_USED */            "Result is not used, operator has no effect",
210264919Sjkim/*    ASL_MSG_RETURN_TYPES */               "Not all control paths return a value",
211264919Sjkim/*    ASL_MSG_SCOPE_FWD_REF */              "Forward references from Scope operator not allowed",
212264919Sjkim/*    ASL_MSG_SCOPE_TYPE */                 "Existing object has invalid type for Scope operator",
213264919Sjkim/*    ASL_MSG_SEEK */                       "Could not seek file",
214264919Sjkim/*    ASL_MSG_SERIALIZED */                 "Control Method marked Serialized",
215264919Sjkim/*    ASL_MSG_SERIALIZED_REQUIRED */        "Control Method should be made Serialized",
216264919Sjkim/*    ASL_MSG_SINGLE_NAME_OPTIMIZATION */   "NamePath optimized to NameSeg (uses run-time search path)",
217264919Sjkim/*    ASL_MSG_SOME_NO_RETVAL */             "Called method may not always return a value",
218264919Sjkim/*    ASL_MSG_STRING_LENGTH */              "String literal too long",
219264919Sjkim/*    ASL_MSG_SWITCH_TYPE */                "Switch expression is not a static Integer/Buffer/String data type, defaulting to Integer",
220264919Sjkim/*    ASL_MSG_SYNC_LEVEL */                 "SyncLevel must be in the range 0-15",
221264919Sjkim/*    ASL_MSG_SYNTAX */                     "",
222264919Sjkim/*    ASL_MSG_TABLE_SIGNATURE */            "Invalid Table Signature",
223264919Sjkim/*    ASL_MSG_TAG_LARGER */                 "ResourceTag larger than Field",
224264919Sjkim/*    ASL_MSG_TAG_SMALLER */                "ResourceTag smaller than Field",
225264919Sjkim/*    ASL_MSG_TIMEOUT */                    "Result is not used, possible operator timeout will be missed",
226264919Sjkim/*    ASL_MSG_TOO_MANY_TEMPS */             "Method requires too many temporary variables (_T_x)",
227306536Sjkim/*    ASL_MSG_TRUNCATION */                 "64-bit return value will be truncated to 32 bits (DSDT or SSDT version < 2)",
228264919Sjkim/*    ASL_MSG_UNKNOWN_RESERVED_NAME */      "Unknown reserved name",
229264919Sjkim/*    ASL_MSG_UNREACHABLE_CODE */           "Statement is unreachable",
230264919Sjkim/*    ASL_MSG_UNSUPPORTED */                "Unsupported feature",
231264919Sjkim/*    ASL_MSG_UPPER_CASE */                 "Non-hex letters must be upper case",
232264919Sjkim/*    ASL_MSG_VENDOR_LIST */                "Too many vendor data bytes (7 max)",
233264919Sjkim/*    ASL_MSG_WRITE */                      "Could not write file",
234264919Sjkim/*    ASL_MSG_RANGE */                      "Constant out of range",
235264919Sjkim/*    ASL_MSG_BUFFER_ALLOCATION */          "Could not allocate line buffer",
236272444Sjkim/*    ASL_MSG_MISSING_DEPENDENCY */         "Missing dependency",
237272444Sjkim/*    ASL_MSG_ILLEGAL_FORWARD_REF */        "Illegal forward reference within a method",
238306536Sjkim/*    ASL_MSG_ILLEGAL_METHOD_REF */         "Illegal reference across two methods",
239306536Sjkim/*    ASL_MSG_LOCAL_NOT_USED */             "Method Local is set but never used",
240306536Sjkim/*    ASL_MSG_ARG_AS_LOCAL_NOT_USED */      "Method Argument (as a local) is set but never used",
241306536Sjkim/*    ASL_MSG_ARG_NOT_USED */               "Method Argument is never used",
242306536Sjkim/*    ASL_MSG_CONSTANT_REQUIRED */          "Non-reducible expression",
243306536Sjkim/*    ASL_MSG_CROSS_TABLE_SCOPE */          "Illegal open scope on external object from within DSDT"
244264919Sjkim};
245264919Sjkim
246264919Sjkim/* Table compiler */
247264919Sjkim
248264919Sjkimconst char                      *AslTableCompilerMsgs [] =
249264919Sjkim{
250264919Sjkim/*    ASL_MSG_BUFFER_ELEMENT */             "Invalid element in buffer initializer list",
251264919Sjkim/*    ASL_MSG_DIVIDE_BY_ZERO */             "Expression contains divide-by-zero",
252264919Sjkim/*    ASL_MSG_FLAG_VALUE */                 "Flag value is too large",
253264919Sjkim/*    ASL_MSG_INTEGER_SIZE */               "Integer too large for target",
254264919Sjkim/*    ASL_MSG_INVALID_EXPRESSION */         "Invalid expression",
255264919Sjkim/*    ASL_MSG_INVALID_FIELD_NAME */         "Invalid Field Name",
256264919Sjkim/*    ASL_MSG_INVALID_HEX_INTEGER */        "Invalid hex integer constant",
257264919Sjkim/*    ASL_MSG_OEM_TABLE */                  "OEM table - unknown contents",
258264919Sjkim/*    ASL_MSG_RESERVED_VALUE */             "Reserved field",
259264919Sjkim/*    ASL_MSG_UNKNOWN_LABEL */              "Label is undefined",
260264919Sjkim/*    ASL_MSG_UNKNOWN_SUBTABLE */           "Unknown subtable type",
261264919Sjkim/*    ASL_MSG_UNKNOWN_TABLE */              "Unknown ACPI table signature",
262264919Sjkim/*    ASL_MSG_ZERO_VALUE */                 "Value must be non-zero"
263264919Sjkim};
264264919Sjkim
265264919Sjkim/* Preprocessor */
266264919Sjkim
267264919Sjkimconst char                      *AslPreprocessorMsgs [] =
268264919Sjkim{
269264919Sjkim/*    ASL_MSG_DIRECTIVE_SYNTAX */           "Invalid directive syntax",
270264919Sjkim/*    ASL_MSG_ENDIF_MISMATCH */             "Mismatched #endif",
271264919Sjkim/*    ASL_MSG_ERROR_DIRECTIVE */            "#error",
272264919Sjkim/*    ASL_MSG_EXISTING_NAME */              "Name is already defined",
273264919Sjkim/*    ASL_MSG_INVALID_INVOCATION */         "Invalid macro invocation",
274264919Sjkim/*    ASL_MSG_MACRO_SYNTAX */               "Invalid macro syntax",
275264919Sjkim/*    ASL_MSG_TOO_MANY_ARGUMENTS */         "Too many macro arguments",
276264919Sjkim/*    ASL_MSG_UNKNOWN_DIRECTIVE */          "Unknown directive",
277264919Sjkim/*    ASL_MSG_UNKNOWN_PRAGMA */             "Unknown pragma",
278284460Sjkim/*    ASL_MSG_WARNING_DIRECTIVE */          "#warning",
279284460Sjkim/*    ASL_MSG_INCLUDE_FILE */               "Found a # preprocessor directive in ASL Include() file"
280264919Sjkim};
281264919Sjkim
282264919Sjkim
283264919Sjkim/*******************************************************************************
284264919Sjkim *
285264919Sjkim * FUNCTION:    AeDecodeMessageId
286264919Sjkim *
287264919Sjkim * PARAMETERS:  MessageId               - ASL message ID (exception code) to be
288264919Sjkim *                                        formatted. Possibly fully encoded.
289264919Sjkim *
290264919Sjkim * RETURN:      A string containing the exception message text.
291264919Sjkim *
292264919Sjkim * DESCRIPTION: This function validates and translates an ASL message ID into
293264919Sjkim *              an ASCII string.
294264919Sjkim *
295264919Sjkim ******************************************************************************/
296264919Sjkim
297264919Sjkimconst char *
298264919SjkimAeDecodeMessageId (
299264919Sjkim    UINT16                  MessageId)
300264919Sjkim{
301264919Sjkim    UINT32                  Index;
302264919Sjkim    const char              **MessageTable;
303264919Sjkim
304264919Sjkim
305264919Sjkim    /* Main ASL Compiler messages */
306264919Sjkim
307264919Sjkim    if (MessageId <= ASL_MSG_MAIN_COMPILER_END)
308264919Sjkim    {
309264919Sjkim        MessageTable = AslCompilerMsgs;
310264919Sjkim        Index = MessageId;
311264919Sjkim
312264919Sjkim        if (Index >= ACPI_ARRAY_LENGTH (AslCompilerMsgs))
313264919Sjkim        {
314264919Sjkim            return ("[Unknown ASL Compiler exception ID]");
315264919Sjkim        }
316264919Sjkim    }
317264919Sjkim
318264919Sjkim    /* Data Table Compiler messages */
319264919Sjkim
320264919Sjkim    else if (MessageId <= ASL_MSG_TABLE_COMPILER_END)
321264919Sjkim    {
322264919Sjkim        MessageTable = AslTableCompilerMsgs;
323264919Sjkim        Index = MessageId - ASL_MSG_TABLE_COMPILER;
324264919Sjkim
325264919Sjkim        if (Index >= ACPI_ARRAY_LENGTH (AslTableCompilerMsgs))
326264919Sjkim        {
327264919Sjkim            return ("[Unknown Table Compiler exception ID]");
328264919Sjkim        }
329264919Sjkim    }
330264919Sjkim
331264919Sjkim    /* Preprocessor messages */
332264919Sjkim
333264919Sjkim    else if (MessageId <= ASL_MSG_PREPROCESSOR_END)
334264919Sjkim    {
335264919Sjkim        MessageTable = AslPreprocessorMsgs;
336264919Sjkim        Index = MessageId - ASL_MSG_PREPROCESSOR;
337264919Sjkim
338264919Sjkim        if (Index >= ACPI_ARRAY_LENGTH (AslPreprocessorMsgs))
339264919Sjkim        {
340284460Sjkim            return ("[Unknown Preprocessor exception ID]");
341264919Sjkim        }
342264919Sjkim    }
343264919Sjkim
344264919Sjkim    /* Everything else is unknown */
345264919Sjkim
346264919Sjkim    else
347264919Sjkim    {
348264919Sjkim        return ("[Unknown exception/component ID]");
349264919Sjkim    }
350264919Sjkim
351264919Sjkim    return (MessageTable[Index]);
352264919Sjkim}
353264919Sjkim
354264919Sjkim
355264919Sjkim/*******************************************************************************
356264919Sjkim *
357264919Sjkim * FUNCTION:    AeDecodeExceptionLevel
358264919Sjkim *
359264919Sjkim * PARAMETERS:  Level               - The ASL error level to be decoded
360264919Sjkim *
361264919Sjkim * RETURN:      A string containing the error level text
362264919Sjkim *
363264919Sjkim * DESCRIPTION: This function validates and translates an ASL error level into
364264919Sjkim *              an ASCII string.
365264919Sjkim *
366264919Sjkim ******************************************************************************/
367264919Sjkim
368264919Sjkimconst char *
369264919SjkimAeDecodeExceptionLevel (
370264919Sjkim    UINT8                   Level)
371264919Sjkim{
372264919Sjkim    /* Range check on Level */
373264919Sjkim
374264919Sjkim    if (Level >= ACPI_ARRAY_LENGTH (AslErrorLevel))
375264919Sjkim    {
376264919Sjkim        return ("Unknown exception level");
377264919Sjkim    }
378264919Sjkim
379264919Sjkim    /* Differentiate the string type to be used (IDE is all lower case) */
380264919Sjkim
381264919Sjkim    if (Gbl_VerboseErrors)
382264919Sjkim    {
383264919Sjkim        return (AslErrorLevel[Level]);
384264919Sjkim    }
385264919Sjkim
386264919Sjkim    return (AslErrorLevelIde[Level]);
387264919Sjkim}
388264919Sjkim
389264919Sjkim
390264919Sjkim/*******************************************************************************
391264919Sjkim *
392264919Sjkim * FUNCTION:    AeBuildFullExceptionCode
393264919Sjkim *
394264919Sjkim * PARAMETERS:  Level               - ASL error level
395264919Sjkim *              MessageId           - ASL exception code to be formatted
396264919Sjkim *
397264919Sjkim * RETURN:      Fully encoded exception code
398264919Sjkim *
399264919Sjkim * DESCRIPTION: Build the full exception code from the error level and the
400264919Sjkim *              actual message ID.
401264919Sjkim *
402264919Sjkim ******************************************************************************/
403264919Sjkim
404264919SjkimUINT16
405264919SjkimAeBuildFullExceptionCode (
406264919Sjkim    UINT8                   Level,
407264919Sjkim    UINT16                  MessageId)
408264919Sjkim{
409264919Sjkim
410264919Sjkim    /*
411264919Sjkim     * Error level is in the thousands slot (error/warning/remark, etc.)
412264919Sjkim     * Error codes are 0 - 999
413264919Sjkim     */
414264919Sjkim    return (((Level + 1) * 1000) + MessageId);
415264919Sjkim}
416