aslmessages.c revision 298714
151974Smsmith/******************************************************************************
265245Smsmith *
365245Smsmith * Module Name: aslmessages.c - Compiler error/warning message strings
451974Smsmith *
551974Smsmith *****************************************************************************/
651974Smsmith
751974Smsmith/*
851974Smsmith * Copyright (C) 2000 - 2016, Intel Corp.
951974Smsmith * All rights reserved.
1051974Smsmith *
1151974Smsmith * Redistribution and use in source and binary forms, with or without
1251974Smsmith * modification, are permitted provided that the following conditions
1351974Smsmith * are met:
1451974Smsmith * 1. Redistributions of source code must retain the above copyright
1551974Smsmith *    notice, this list of conditions, and the following disclaimer,
1651974Smsmith *    without modification.
1751974Smsmith * 2. Redistributions in binary form must reproduce at minimum a disclaimer
1851974Smsmith *    substantially similar to the "NO WARRANTY" disclaimer below
1951974Smsmith *    ("Disclaimer") and any redistribution must be conditioned upon
2051974Smsmith *    including a substantially similar Disclaimer requirement for further
2151974Smsmith *    binary redistribution.
2251974Smsmith * 3. Neither the names of the above-listed copyright holders nor the names
2351974Smsmith *    of any contributors may be used to endorse or promote products derived
2451974Smsmith *    from this software without specific prior written permission.
2551974Smsmith *
2651974Smsmith * Alternatively, this software may be distributed under the terms of the
27106225Semoore * GNU General Public License ("GPL") version 2 as published by the Free
28106225Semoore * Software Foundation.
29106225Semoore *
30106225Semoore * NO WARRANTY
31106225Semoore * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
32106225Semoore * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
33106225Semoore * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
34106225Semoore * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
35106225Semoore * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
36106225Semoore * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
37106225Semoore * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
38106225Semoore * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
39105419Semoore * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
40106225Semoore * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
41105419Semoore * POSSIBILITY OF SUCH DAMAGES.
42105419Semoore */
43106225Semoore
44106225Semoore#include <contrib/dev/acpica/compiler/aslcompiler.h>
45106225Semoore
46106225Semoore#define _COMPONENT          ACPI_COMPILER
47106225Semoore        ACPI_MODULE_NAME    ("aslmessages")
48106225Semoore
49106225Semoore
50106225Semoore/*
51106225Semoore * Strings for message reporting levels, must match error
52106225Semoore * type string tables in aslmessages.c
53106225Semoore */
54105419Semooreconst char              *AslErrorLevel [ASL_NUM_REPORT_LEVELS] = {
55106225Semoore    "Optimize",
5651974Smsmith    "Remark  ",
5751974Smsmith    "Warning ",
5851974Smsmith    "Warning ",
5951974Smsmith    "Warning ",
6065245Smsmith    "Error   "
6151974Smsmith};
6251974Smsmith
6351974Smsmith/* All lowercase versions for IDEs */
6451974Smsmith
6551974Smsmithconst char              *AslErrorLevelIde [ASL_NUM_REPORT_LEVELS] = {
6651974Smsmith    "optimize",
6751974Smsmith    "remark  ",
6865245Smsmith    "warning ",
6951974Smsmith    "warning ",
7051974Smsmith    "warning ",
7151974Smsmith    "error   "
7251974Smsmith};
7365245Smsmith
7451974Smsmith
7565245Smsmith/*
7665245Smsmith * Actual message strings for each compiler message ID. There are currently
7765245Smsmith * three distinct blocks of error messages (so that they can be expanded
7851974Smsmith * individually):
7951974Smsmith *      Main ASL compiler
8051974Smsmith *      Data Table compiler
8165245Smsmith *      Preprocessor
8265245Smsmith *
8365245Smsmith * NOTE1: These tables must match the enum list of message IDs in the file
8451974Smsmith * aslmessages.h exactly.
8551974Smsmith *
8651974Smsmith * NOTE2: With the introduction of the -vw option to disable specific messages,
8765245Smsmith * new messages should only be added to the end of this list, so that values
8865245Smsmith * for existing messages are not disturbed.
8951974Smsmith */
9051974Smsmith
9151974Smsmith/* ASL compiler */
9265245Smsmith
9365245Smsmithconst char                      *AslCompilerMsgs [] =
9465245Smsmith{
9565245Smsmith/*    The zeroth message is reserved */    "",
9651974Smsmith/*    ASL_MSG_ALIGNMENT */                  "Must be a multiple of alignment/granularity value",
9751974Smsmith/*    ASL_MSG_ALPHANUMERIC_STRING */        "String must be entirely alphanumeric",
9851974Smsmith/*    ASL_MSG_AML_NOT_IMPLEMENTED */        "Opcode is not implemented in compiler AML code generator",
9951974Smsmith/*    ASL_MSG_ARG_COUNT_HI */               "Too many arguments",
10051974Smsmith/*    ASL_MSG_ARG_COUNT_LO */               "Too few arguments",
10151974Smsmith/*    ASL_MSG_ARG_INIT */                   "Method argument is not initialized",
10251974Smsmith/*    ASL_MSG_BACKWARDS_OFFSET */           "Invalid backwards offset",
10351974Smsmith/*    ASL_MSG_BUFFER_LENGTH */              "Effective AML buffer length is zero",
10451974Smsmith/*    ASL_MSG_CLOSE */                      "Could not close file",
10551974Smsmith/*    ASL_MSG_COMPILER_INTERNAL */          "Internal compiler error",
10651974Smsmith/*    ASL_MSG_COMPILER_RESERVED */          "Use of compiler reserved name",
10751974Smsmith/*    ASL_MSG_CONNECTION_MISSING */         "A Connection operator is required for this field SpaceId",
10851974Smsmith/*    ASL_MSG_CONNECTION_INVALID */         "Invalid OpRegion SpaceId for use of Connection operator",
10951974Smsmith/*    ASL_MSG_CONSTANT_EVALUATION */        "Could not evaluate constant expression",
11051974Smsmith/*    ASL_MSG_CONSTANT_FOLDED */            "Constant expression evaluated and reduced",
11151974Smsmith/*    ASL_MSG_CORE_EXCEPTION */             "From ACPICA Subsystem",
11265245Smsmith/*    ASL_MSG_DEBUG_FILE_OPEN */            "Could not open debug file",
11365245Smsmith/*    ASL_MSG_DEBUG_FILENAME */             "Could not create debug filename",
11465245Smsmith/*    ASL_MSG_DEPENDENT_NESTING */          "Dependent function macros cannot be nested",
11565245Smsmith/*    ASL_MSG_DMA_CHANNEL */                "Invalid DMA channel (must be 0-7)",
11651974Smsmith/*    ASL_MSG_DMA_LIST */                   "Too many DMA channels (8 max)",
11751974Smsmith/*    ASL_MSG_DUPLICATE_CASE */             "Case value already specified",
11851974Smsmith/*    ASL_MSG_DUPLICATE_ITEM */             "Duplicate value in list",
11951974Smsmith/*    ASL_MSG_EARLY_EOF */                  "Premature end-of-file reached",
12065245Smsmith/*    ASL_MSG_ENCODING_LENGTH */            "Package length too long to encode",
12165245Smsmith/*    ASL_MSG_EX_INTERRUPT_LIST */          "Too many interrupts (255 max)",
12265245Smsmith/*    ASL_MSG_EX_INTERRUPT_LIST_MIN */      "Too few interrupts (1 minimum required)",
12365245Smsmith/*    ASL_MSG_EX_INTERRUPT_NUMBER */        "Invalid interrupt number (must be 32 bits)",
124106225Semoore/*    ASL_MSG_FIELD_ACCESS_WIDTH */         "Access width is greater than region size",
12551974Smsmith/*    ASL_MSG_FIELD_UNIT_ACCESS_WIDTH */    "Access width of Field Unit extends beyond region limit",
12651974Smsmith/*    ASL_MSG_FIELD_UNIT_OFFSET */          "Field Unit extends beyond region limit",
12765245Smsmith/*    ASL_MSG_GPE_NAME_CONFLICT */          "Name conflicts with a previous GPE method",
12851974Smsmith/*    ASL_MSG_HID_LENGTH */                 "_HID string must be exactly 7 or 8 characters",
12965245Smsmith/*    ASL_MSG_HID_PREFIX */                 "_HID prefix must be all uppercase or decimal digits",
13065245Smsmith/*    ASL_MSG_HID_SUFFIX */                 "_HID suffix must be all hex digits",
13151974Smsmith/*    ASL_MSG_INCLUDE_FILE_OPEN */          "Could not open include file",
13251974Smsmith/*    ASL_MSG_INPUT_FILE_OPEN */            "Could not open input file",
13365245Smsmith/*    ASL_MSG_INTEGER_LENGTH */             "64-bit integer in 32-bit table, truncating (DSDT or SSDT version < 2)",
13451974Smsmith/*    ASL_MSG_INTEGER_OPTIMIZATION */       "Integer optimized to single-byte AML opcode",
13565245Smsmith/*    ASL_MSG_INTERRUPT_LIST */             "Too many interrupts (16 max)",
13665245Smsmith/*    ASL_MSG_INTERRUPT_NUMBER */           "Invalid interrupt number (must be 0-15)",
13765245Smsmith/*    ASL_MSG_INVALID_ACCESS_SIZE */        "Invalid AccessSize (Maximum is 4 - QWord access)",
13865245Smsmith/*    ASL_MSG_INVALID_ADDR_FLAGS */         "Invalid combination of Length and Min/Max fixed flags",
13965245Smsmith/*    ASL_MSG_INVALID_CONSTANT_OP */        "Invalid operator in constant expression (not type 3/4/5)",
14065245Smsmith/*    ASL_MSG_INVALID_EISAID */             "EISAID string must be of the form \"UUUXXXX\" (3 uppercase, 4 hex digits)",
14165245Smsmith/*    ASL_MSG_INVALID_ESCAPE */             "Invalid or unknown escape sequence",
14251974Smsmith/*    ASL_MSG_INVALID_GRAN_FIXED */         "Granularity must be zero for fixed Min/Max",
14351974Smsmith/*    ASL_MSG_INVALID_GRANULARITY */        "Granularity must be zero or a power of two minus one",
14458883Smsmith/*    ASL_MSG_INVALID_LENGTH */             "Length is larger than Min/Max window",
14558883Smsmith/*    ASL_MSG_INVALID_LENGTH_FIXED */       "Length is not equal to fixed Min/Max window",
14665245Smsmith/*    ASL_MSG_INVALID_MIN_MAX */            "Address Min is greater than Address Max",
14758883Smsmith/*    ASL_MSG_INVALID_OPERAND */            "Invalid operand",
14858883Smsmith/*    ASL_MSG_INVALID_PERFORMANCE */        "Invalid performance/robustness value",
14951974Smsmith/*    ASL_MSG_INVALID_PRIORITY */           "Invalid priority value",
15051974Smsmith/*    ASL_MSG_INVALID_STRING */             "Invalid Hex/Octal Escape - Non-ASCII or NULL",
15165245Smsmith/*    ASL_MSG_INVALID_TARGET */             "Target operand not allowed in constant expression",
15265245Smsmith/*    ASL_MSG_INVALID_TIME */               "Time parameter too long (255 max)",
153107756Semoore/*    ASL_MSG_INVALID_TYPE */               "Invalid type",
15451974Smsmith/*    ASL_MSG_INVALID_UUID */               "UUID string must be of the form \"aabbccdd-eeff-gghh-iijj-kkllmmnnoopp\"",
15565245Smsmith/*    ASL_MSG_ISA_ADDRESS */                "Maximum 10-bit ISA address (0x3FF)",
15665245Smsmith/*    ASL_MSG_LEADING_ASTERISK */           "Invalid leading asterisk",
157107756Semoore/*    ASL_MSG_LIST_LENGTH_LONG */           "Initializer list longer than declared package length",
15865245Smsmith/*    ASL_MSG_LIST_LENGTH_SHORT */          "Initializer list shorter than declared package length",
15951974Smsmith/*    ASL_MSG_LISTING_FILE_OPEN */          "Could not open listing file",
16065245Smsmith/*    ASL_MSG_LISTING_FILENAME */           "Could not create listing filename",
16165245Smsmith/*    ASL_MSG_LOCAL_INIT */                 "Method local variable is not initialized",
16265245Smsmith/*    ASL_MSG_LOCAL_OUTSIDE_METHOD */       "Local or Arg used outside a control method",
16365245Smsmith/*    ASL_MSG_LONG_LINE */                  "Splitting long input line",
16465245Smsmith/*    ASL_MSG_MEMORY_ALLOCATION */          "Memory allocation failure",
16551974Smsmith/*    ASL_MSG_MISSING_ENDDEPENDENT */       "Missing EndDependentFn() macro in dependent resource list",
16651974Smsmith/*    ASL_MSG_MISSING_STARTDEPENDENT */     "Missing StartDependentFn() macro in dependent resource list",
16751974Smsmith/*    ASL_MSG_MULTIPLE_DEFAULT */           "More than one Default statement within Switch construct",
16865245Smsmith/*    ASL_MSG_MULTIPLE_TYPES */             "Multiple types",
16965245Smsmith/*    ASL_MSG_NAME_EXISTS */                "Name already exists in scope",
170107756Semoore/*    ASL_MSG_NAME_OPTIMIZATION */          "NamePath optimized",
17165245Smsmith/*    ASL_MSG_NAMED_OBJECT_IN_WHILE */      "Creating a named object in a While loop",
17265245Smsmith/*    ASL_MSG_NESTED_COMMENT */             "Nested comment found",
173107756Semoore/*    ASL_MSG_NO_CASES */                   "No Case statements under Switch",
17451974Smsmith/*    ASL_MSG_NO_REGION */                  "_REG has no corresponding Operation Region",
17551974Smsmith/*    ASL_MSG_NO_RETVAL */                  "Called method returns no value",
17651974Smsmith/*    ASL_MSG_NO_WHILE */                   "No enclosing While statement",
17765245Smsmith/*    ASL_MSG_NON_ASCII */                  "Invalid characters found in file",
17851974Smsmith/*    ASL_MSG_NON_ZERO */                   "Operand evaluates to zero",
17951974Smsmith/*    ASL_MSG_NOT_EXIST */                  "Object does not exist",
18051974Smsmith/*    ASL_MSG_NOT_FOUND */                  "Object not found or not accessible from scope",
18151974Smsmith/*    ASL_MSG_NOT_METHOD */                 "Not a control method, cannot invoke",
18265245Smsmith/*    ASL_MSG_NOT_PARAMETER */              "Not a parameter, used as local only",
18365245Smsmith/*    ASL_MSG_NOT_REACHABLE */              "Object is not accessible from this scope",
18465245Smsmith/*    ASL_MSG_NOT_REFERENCED */             "Object is not referenced",
18565245Smsmith/*    ASL_MSG_NULL_DESCRIPTOR */            "Min/Max/Length/Gran are all zero, but no resource tag",
18651974Smsmith/*    ASL_MSG_NULL_STRING */                "Invalid zero-length (null) string",
18751974Smsmith/*    ASL_MSG_OPEN */                       "Could not open file",
18851974Smsmith/*    ASL_MSG_OUTPUT_FILE_OPEN */           "Could not open output AML file",
18951974Smsmith/*    ASL_MSG_OUTPUT_FILENAME */            "Could not create output filename",
19051974Smsmith/*    ASL_MSG_PACKAGE_LENGTH */             "Effective AML package length is zero",
19151974Smsmith/*    ASL_MSG_PREPROCESSOR_FILENAME */      "Could not create preprocessor filename",
19251974Smsmith/*    ASL_MSG_READ */                       "Could not read file",
19351974Smsmith/*    ASL_MSG_RECURSION */                  "Recursive method call",
19465245Smsmith/*    ASL_MSG_REGION_BUFFER_ACCESS */       "Host Operation Region requires BufferAcc access",
19565245Smsmith/*    ASL_MSG_REGION_BYTE_ACCESS */         "Host Operation Region requires ByteAcc access",
19651974Smsmith/*    ASL_MSG_RESERVED_ARG_COUNT_HI */      "Reserved method has too many arguments",
19751974Smsmith/*    ASL_MSG_RESERVED_ARG_COUNT_LO */      "Reserved method has too few arguments",
19851974Smsmith/*    ASL_MSG_RESERVED_METHOD */            "Reserved name must be a control method",
19965245Smsmith/*    ASL_MSG_RESERVED_NO_RETURN_VAL */     "Reserved method should not return a value",
20051974Smsmith/*    ASL_MSG_RESERVED_OPERAND_TYPE */      "Invalid object type for reserved name",
20165245Smsmith/*    ASL_MSG_RESERVED_PACKAGE_LENGTH */    "Invalid package length for reserved name",
20265245Smsmith/*    ASL_MSG_RESERVED_RETURN_VALUE */      "Reserved method must return a value",
20359249Sphk/*    ASL_MSG_RESERVED_USE */               "Invalid use of reserved name",
20451974Smsmith/*    ASL_MSG_RESERVED_WORD */              "Use of reserved name",
20565245Smsmith/*    ASL_MSG_RESOURCE_FIELD */             "Resource field name cannot be used as a target",
20651974Smsmith/*    ASL_MSG_RESOURCE_INDEX */             "Missing ResourceSourceIndex (required)",
20765245Smsmith/*    ASL_MSG_RESOURCE_LIST */              "Too many resource items (internal error)",
20865245Smsmith/*    ASL_MSG_RESOURCE_SOURCE */            "Missing ResourceSource string (required)",
20965245Smsmith/*    ASL_MSG_RESULT_NOT_USED */            "Result is not used, operator has no effect",
21065245Smsmith/*    ASL_MSG_RETURN_TYPES */               "Not all control paths return a value",
21165245Smsmith/*    ASL_MSG_SCOPE_FWD_REF */              "Forward references from Scope operator not allowed",
21265245Smsmith/*    ASL_MSG_SCOPE_TYPE */                 "Existing object has invalid type for Scope operator",
21365245Smsmith/*    ASL_MSG_SEEK */                       "Could not seek file",
21465245Smsmith/*    ASL_MSG_SERIALIZED */                 "Control Method marked Serialized",
21551974Smsmith/*    ASL_MSG_SERIALIZED_REQUIRED */        "Control Method should be made Serialized",
21651974Smsmith/*    ASL_MSG_SINGLE_NAME_OPTIMIZATION */   "NamePath optimized to NameSeg (uses run-time search path)",
21765245Smsmith/*    ASL_MSG_SOME_NO_RETVAL */             "Called method may not always return a value",
21851974Smsmith/*    ASL_MSG_STRING_LENGTH */              "String literal too long",
21951974Smsmith/*    ASL_MSG_SWITCH_TYPE */                "Switch expression is not a static Integer/Buffer/String data type, defaulting to Integer",
220107756Semoore/*    ASL_MSG_SYNC_LEVEL */                 "SyncLevel must be in the range 0-15",
22151974Smsmith/*    ASL_MSG_SYNTAX */                     "",
22251974Smsmith/*    ASL_MSG_TABLE_SIGNATURE */            "Invalid Table Signature",
22351974Smsmith/*    ASL_MSG_TAG_LARGER */                 "ResourceTag larger than Field",
224107756Semoore/*    ASL_MSG_TAG_SMALLER */                "ResourceTag smaller than Field",
22565245Smsmith/*    ASL_MSG_TIMEOUT */                    "Result is not used, possible operator timeout will be missed",
22651974Smsmith/*    ASL_MSG_TOO_MANY_TEMPS */             "Method requires too many temporary variables (_T_x)",
22751974Smsmith/*    ASL_MSG_TRUNCATION */                 "64-bit return value will be truncated to 32 bits (DSDT or SSDT version < 2)",
22865245Smsmith/*    ASL_MSG_UNKNOWN_RESERVED_NAME */      "Unknown reserved name",
22965245Smsmith/*    ASL_MSG_UNREACHABLE_CODE */           "Statement is unreachable",
23065245Smsmith/*    ASL_MSG_UNSUPPORTED */                "Unsupported feature",
23165245Smsmith/*    ASL_MSG_UPPER_CASE */                 "Non-hex letters must be upper case",
23251974Smsmith/*    ASL_MSG_VENDOR_LIST */                "Too many vendor data bytes (7 max)",
23351974Smsmith/*    ASL_MSG_WRITE */                      "Could not write file",
23465245Smsmith/*    ASL_MSG_RANGE */                      "Constant out of range",
23551974Smsmith/*    ASL_MSG_BUFFER_ALLOCATION */          "Could not allocate line buffer",
23665245Smsmith/*    ASL_MSG_MISSING_DEPENDENCY */         "Missing dependency",
23765245Smsmith/*    ASL_MSG_ILLEGAL_FORWARD_REF */        "Illegal forward reference within a method",
23851974Smsmith/*    ASL_MSG_ILLEGAL_METHOD_REF */         "Illegal reference across two methods",
23965245Smsmith/*    ASL_MSG_LOCAL_NOT_USED */             "Method Local is set but never used",
24051974Smsmith/*    ASL_MSG_ARG_AS_LOCAL_NOT_USED */      "Method Argument (as a local) is set but never used",
24151974Smsmith/*    ASL_MSG_ARG_NOT_USED */               "Method Argument is never used",
24265245Smsmith/*    ASL_MSG_CONSTANT_REQUIRED */          "Non-reducible expression",
24351974Smsmith/*    ASL_MSG_CROSS_TABLE_SCOPE */          "Illegal open scope on external object from within DSDT"
24465245Smsmith};
24551974Smsmith
24665245Smsmith/* Table compiler */
24751974Smsmith
24851974Smsmithconst char                      *AslTableCompilerMsgs [] =
24965245Smsmith{
25051974Smsmith/*    ASL_MSG_BUFFER_ELEMENT */             "Invalid element in buffer initializer list",
25165245Smsmith/*    ASL_MSG_DIVIDE_BY_ZERO */             "Expression contains divide-by-zero",
25265245Smsmith/*    ASL_MSG_FLAG_VALUE */                 "Flag value is too large",
25365245Smsmith/*    ASL_MSG_INTEGER_SIZE */               "Integer too large for target",
25451974Smsmith/*    ASL_MSG_INVALID_EXPRESSION */         "Invalid expression",
25551974Smsmith/*    ASL_MSG_INVALID_FIELD_NAME */         "Invalid Field Name",
25665245Smsmith/*    ASL_MSG_INVALID_HEX_INTEGER */        "Invalid hex integer constant",
25765245Smsmith/*    ASL_MSG_OEM_TABLE */                  "OEM table - unknown contents",
25851974Smsmith/*    ASL_MSG_RESERVED_VALUE */             "Reserved field",
25965245Smsmith/*    ASL_MSG_UNKNOWN_LABEL */              "Label is undefined",
26065245Smsmith/*    ASL_MSG_UNKNOWN_SUBTABLE */           "Unknown subtable type",
26165245Smsmith/*    ASL_MSG_UNKNOWN_TABLE */              "Unknown ACPI table signature",
26265245Smsmith/*    ASL_MSG_ZERO_VALUE */                 "Value must be non-zero"
26365245Smsmith};
26465245Smsmith
26565245Smsmith/* Preprocessor */
26651974Smsmith
26758883Smsmithconst char                      *AslPreprocessorMsgs [] =
26865245Smsmith{
26958883Smsmith/*    ASL_MSG_DIRECTIVE_SYNTAX */           "Invalid directive syntax",
27065245Smsmith/*    ASL_MSG_ENDIF_MISMATCH */             "Mismatched #endif",
27158883Smsmith/*    ASL_MSG_ERROR_DIRECTIVE */            "#error",
27265245Smsmith/*    ASL_MSG_EXISTING_NAME */              "Name is already defined",
27351974Smsmith/*    ASL_MSG_INVALID_INVOCATION */         "Invalid macro invocation",
27451974Smsmith/*    ASL_MSG_MACRO_SYNTAX */               "Invalid macro syntax",
27551974Smsmith/*    ASL_MSG_TOO_MANY_ARGUMENTS */         "Too many macro arguments",
27651974Smsmith/*    ASL_MSG_UNKNOWN_DIRECTIVE */          "Unknown directive",
27751974Smsmith/*    ASL_MSG_UNKNOWN_PRAGMA */             "Unknown pragma",
27851974Smsmith/*    ASL_MSG_WARNING_DIRECTIVE */          "#warning",
27965245Smsmith/*    ASL_MSG_INCLUDE_FILE */               "Found a # preprocessor directive in ASL Include() file"
28065245Smsmith};
28151974Smsmith
28265245Smsmith
28351974Smsmith/*******************************************************************************
28451974Smsmith *
28551974Smsmith * FUNCTION:    AeDecodeMessageId
28665245Smsmith *
28751974Smsmith * PARAMETERS:  MessageId               - ASL message ID (exception code) to be
28865245Smsmith *                                        formatted. Possibly fully encoded.
28965245Smsmith *
29065245Smsmith * RETURN:      A string containing the exception message text.
29151974Smsmith *
29251974Smsmith * DESCRIPTION: This function validates and translates an ASL message ID into
29365245Smsmith *              an ASCII string.
29451974Smsmith *
29551974Smsmith ******************************************************************************/
29651974Smsmith
29751974Smsmithconst char *
29851974SmsmithAeDecodeMessageId (
29951974Smsmith    UINT16                  MessageId)
30051974Smsmith{
30151974Smsmith    UINT32                  Index;
30251974Smsmith    const char              **MessageTable;
30351974Smsmith
30451974Smsmith
30551974Smsmith    /* Main ASL Compiler messages */
30651974Smsmith
30751974Smsmith    if (MessageId <= ASL_MSG_MAIN_COMPILER_END)
30851974Smsmith    {
30951974Smsmith        MessageTable = AslCompilerMsgs;
31051974Smsmith        Index = MessageId;
31154073Smdodd
31251974Smsmith        if (Index >= ACPI_ARRAY_LENGTH (AslCompilerMsgs))
31351974Smsmith        {
31454073Smdodd            return ("[Unknown ASL Compiler exception ID]");
31551974Smsmith        }
31651974Smsmith    }
31751974Smsmith
31851974Smsmith    /* Data Table Compiler messages */
31951974Smsmith
32051974Smsmith    else if (MessageId <= ASL_MSG_TABLE_COMPILER_END)
32151974Smsmith    {
32251974Smsmith        MessageTable = AslTableCompilerMsgs;
32351974Smsmith        Index = MessageId - ASL_MSG_TABLE_COMPILER;
32451974Smsmith
32551974Smsmith        if (Index >= ACPI_ARRAY_LENGTH (AslTableCompilerMsgs))
32651974Smsmith        {
32751974Smsmith            return ("[Unknown Table Compiler exception ID]");
32865245Smsmith        }
32951974Smsmith    }
33065245Smsmith
33151974Smsmith    /* Preprocessor messages */
33265245Smsmith
33351974Smsmith    else if (MessageId <= ASL_MSG_PREPROCESSOR_END)
33451974Smsmith    {
33565245Smsmith        MessageTable = AslPreprocessorMsgs;
33665245Smsmith        Index = MessageId - ASL_MSG_PREPROCESSOR;
33751974Smsmith
33865245Smsmith        if (Index >= ACPI_ARRAY_LENGTH (AslPreprocessorMsgs))
33965245Smsmith        {
34051974Smsmith            return ("[Unknown Preprocessor exception ID]");
34165245Smsmith        }
34251974Smsmith    }
34365245Smsmith
344107756Semoore    /* Everything else is unknown */
34551974Smsmith
34665245Smsmith    else
34765245Smsmith    {
34851974Smsmith        return ("[Unknown exception/component ID]");
34965245Smsmith    }
35065245Smsmith
35165245Smsmith    return (MessageTable[Index]);
35265245Smsmith}
35351974Smsmith
354107756Semoore
355107756Semoore/*******************************************************************************
356107756Semoore *
357107756Semoore * FUNCTION:    AeDecodeExceptionLevel
35851974Smsmith *
35951974Smsmith * PARAMETERS:  Level               - The ASL error level to be decoded
36051974Smsmith *
36165245Smsmith * RETURN:      A string containing the error level text
36251974Smsmith *
36351974Smsmith * DESCRIPTION: This function validates and translates an ASL error level into
36451974Smsmith *              an ASCII string.
36565245Smsmith *
36651974Smsmith ******************************************************************************/
36765245Smsmith
36852543Smsmithconst char *
36965245SmsmithAeDecodeExceptionLevel (
37051974Smsmith    UINT8                   Level)
37151974Smsmith{
37251974Smsmith    /* Range check on Level */
37351974Smsmith
37451974Smsmith    if (Level >= ACPI_ARRAY_LENGTH (AslErrorLevel))
37551974Smsmith    {
37651974Smsmith        return ("Unknown exception level");
377104094Sphk    }
378105419Semoore
37951974Smsmith    /* Differentiate the string type to be used (IDE is all lower case) */
38051974Smsmith
38189055Smsmith    if (Gbl_VerboseErrors)
38251974Smsmith    {
38365245Smsmith        return (AslErrorLevel[Level]);
38465245Smsmith    }
38551974Smsmith
38651974Smsmith    return (AslErrorLevelIde[Level]);
38751974Smsmith}
38851974Smsmith
38951974Smsmith
39051974Smsmith/*******************************************************************************
39151974Smsmith *
392104094Sphk * FUNCTION:    AeBuildFullExceptionCode
393105419Semoore *
39451974Smsmith * PARAMETERS:  Level               - ASL error level
39551974Smsmith *              MessageId           - ASL exception code to be formatted
39689055Smsmith *
39751974Smsmith * RETURN:      Fully encoded exception code
39865245Smsmith *
39965245Smsmith * DESCRIPTION: Build the full exception code from the error level and the
40051974Smsmith *              actual message ID.
40151974Smsmith *
40251974Smsmith ******************************************************************************/
40351974Smsmith
40451974SmsmithUINT16
40551974SmsmithAeBuildFullExceptionCode (
40651974Smsmith    UINT8                   Level,
407104094Sphk    UINT16                  MessageId)
408105419Semoore{
40951974Smsmith
41065245Smsmith    /*
41165245Smsmith     * Error level is in the thousands slot (error/warning/remark, etc.)
41265245Smsmith     * Error codes are 0 - 999
41365245Smsmith     */
41465245Smsmith    return (((Level + 1) * 1000) + MessageId);
41565245Smsmith}
41665245Smsmith