xref: /netbsd-src/sys/external/bsd/acpica/dist/compiler/aslmessages.c (revision 046a29855e04359424fd074e8313af6b6be8cfb6)
1460301d4Schristos /******************************************************************************
2460301d4Schristos  *
3460301d4Schristos  * Module Name: aslmessages.c - Compiler error/warning message strings
4460301d4Schristos  *
5460301d4Schristos  *****************************************************************************/
6460301d4Schristos 
7460301d4Schristos /*
8*046a2985Schristos  * Copyright (C) 2000 - 2023, Intel Corp.
9460301d4Schristos  * All rights reserved.
10460301d4Schristos  *
11460301d4Schristos  * Redistribution and use in source and binary forms, with or without
12460301d4Schristos  * modification, are permitted provided that the following conditions
13460301d4Schristos  * are met:
14460301d4Schristos  * 1. Redistributions of source code must retain the above copyright
15460301d4Schristos  *    notice, this list of conditions, and the following disclaimer,
16460301d4Schristos  *    without modification.
17460301d4Schristos  * 2. Redistributions in binary form must reproduce at minimum a disclaimer
18460301d4Schristos  *    substantially similar to the "NO WARRANTY" disclaimer below
19460301d4Schristos  *    ("Disclaimer") and any redistribution must be conditioned upon
20460301d4Schristos  *    including a substantially similar Disclaimer requirement for further
21460301d4Schristos  *    binary redistribution.
22460301d4Schristos  * 3. Neither the names of the above-listed copyright holders nor the names
23460301d4Schristos  *    of any contributors may be used to endorse or promote products derived
24460301d4Schristos  *    from this software without specific prior written permission.
25460301d4Schristos  *
26460301d4Schristos  * Alternatively, this software may be distributed under the terms of the
27460301d4Schristos  * GNU General Public License ("GPL") version 2 as published by the Free
28460301d4Schristos  * Software Foundation.
29460301d4Schristos  *
30460301d4Schristos  * NO WARRANTY
31460301d4Schristos  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
32460301d4Schristos  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
3346a330b4Schristos  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
34460301d4Schristos  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
35460301d4Schristos  * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
36460301d4Schristos  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
37460301d4Schristos  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
38460301d4Schristos  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
39460301d4Schristos  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
40460301d4Schristos  * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
41460301d4Schristos  * POSSIBILITY OF SUCH DAMAGES.
42460301d4Schristos  */
43460301d4Schristos 
44460301d4Schristos #include "aslcompiler.h"
45460301d4Schristos 
46460301d4Schristos #define _COMPONENT          ACPI_COMPILER
47460301d4Schristos         ACPI_MODULE_NAME    ("aslmessages")
48460301d4Schristos 
49460301d4Schristos 
50460301d4Schristos /*
51460301d4Schristos  * Strings for message reporting levels, must match error
52460301d4Schristos  * type string tables in aslmessages.c
53460301d4Schristos  */
54460301d4Schristos const char              *AslErrorLevel [ASL_NUM_REPORT_LEVELS] = {
55460301d4Schristos     "Optimize",
56460301d4Schristos     "Remark  ",
57460301d4Schristos     "Warning ",
58460301d4Schristos     "Warning ",
59460301d4Schristos     "Warning ",
60460301d4Schristos     "Error   "
61460301d4Schristos };
62460301d4Schristos 
63460301d4Schristos /* All lowercase versions for IDEs */
64460301d4Schristos 
65460301d4Schristos const char              *AslErrorLevelIde [ASL_NUM_REPORT_LEVELS] = {
66460301d4Schristos     "optimize",
67460301d4Schristos     "remark  ",
68460301d4Schristos     "warning ",
69460301d4Schristos     "warning ",
70460301d4Schristos     "warning ",
71460301d4Schristos     "error   "
72460301d4Schristos };
73460301d4Schristos 
74460301d4Schristos 
75460301d4Schristos /*
76460301d4Schristos  * Actual message strings for each compiler message ID. There are currently
77460301d4Schristos  * three distinct blocks of error messages (so that they can be expanded
78460301d4Schristos  * individually):
79460301d4Schristos  *      Main ASL compiler
80460301d4Schristos  *      Data Table compiler
81460301d4Schristos  *      Preprocessor
82460301d4Schristos  *
83460301d4Schristos  * NOTE1: These tables must match the enum list of message IDs in the file
84460301d4Schristos  * aslmessages.h exactly.
85460301d4Schristos  *
86460301d4Schristos  * NOTE2: With the introduction of the -vw option to disable specific messages,
87460301d4Schristos  * new messages should only be added to the end of this list, so that values
885b139df6Schristos  * for existing messages are not disturbed. As important, obsolete messages
895b139df6Schristos  * cannot be removed from this list, as it will affect the -vw option.
90460301d4Schristos  */
91460301d4Schristos 
92460301d4Schristos /* ASL compiler */
93460301d4Schristos 
94460301d4Schristos const char                      *AslCompilerMsgs [] =
95460301d4Schristos {
96460301d4Schristos /*    The zeroth message is reserved */    "",
97460301d4Schristos /*    ASL_MSG_ALIGNMENT */                  "Must be a multiple of alignment/granularity value",
98460301d4Schristos /*    ASL_MSG_ALPHANUMERIC_STRING */        "String must be entirely alphanumeric",
99460301d4Schristos /*    ASL_MSG_AML_NOT_IMPLEMENTED */        "Opcode is not implemented in compiler AML code generator",
100460301d4Schristos /*    ASL_MSG_ARG_COUNT_HI */               "Too many arguments",
101460301d4Schristos /*    ASL_MSG_ARG_COUNT_LO */               "Too few arguments",
102460301d4Schristos /*    ASL_MSG_ARG_INIT */                   "Method argument is not initialized",
103460301d4Schristos /*    ASL_MSG_BACKWARDS_OFFSET */           "Invalid backwards offset",
104460301d4Schristos /*    ASL_MSG_BUFFER_LENGTH */              "Effective AML buffer length is zero",
105460301d4Schristos /*    ASL_MSG_CLOSE */                      "Could not close file",
106460301d4Schristos /*    ASL_MSG_COMPILER_INTERNAL */          "Internal compiler error",
107460301d4Schristos /*    ASL_MSG_COMPILER_RESERVED */          "Use of compiler reserved name",
108460301d4Schristos /*    ASL_MSG_CONNECTION_MISSING */         "A Connection operator is required for this field SpaceId",
109460301d4Schristos /*    ASL_MSG_CONNECTION_INVALID */         "Invalid OpRegion SpaceId for use of Connection operator",
110460301d4Schristos /*    ASL_MSG_CONSTANT_EVALUATION */        "Could not evaluate constant expression",
111460301d4Schristos /*    ASL_MSG_CONSTANT_FOLDED */            "Constant expression evaluated and reduced",
112460301d4Schristos /*    ASL_MSG_CORE_EXCEPTION */             "From ACPICA Subsystem",
113460301d4Schristos /*    ASL_MSG_DEBUG_FILE_OPEN */            "Could not open debug file",
114460301d4Schristos /*    ASL_MSG_DEBUG_FILENAME */             "Could not create debug filename",
115460301d4Schristos /*    ASL_MSG_DEPENDENT_NESTING */          "Dependent function macros cannot be nested",
116460301d4Schristos /*    ASL_MSG_DMA_CHANNEL */                "Invalid DMA channel (must be 0-7)",
117460301d4Schristos /*    ASL_MSG_DMA_LIST */                   "Too many DMA channels (8 max)",
118460301d4Schristos /*    ASL_MSG_DUPLICATE_CASE */             "Case value already specified",
119460301d4Schristos /*    ASL_MSG_DUPLICATE_ITEM */             "Duplicate value in list",
120460301d4Schristos /*    ASL_MSG_EARLY_EOF */                  "Premature end-of-file reached",
121460301d4Schristos /*    ASL_MSG_ENCODING_LENGTH */            "Package length too long to encode",
122460301d4Schristos /*    ASL_MSG_EX_INTERRUPT_LIST */          "Too many interrupts (255 max)",
123460301d4Schristos /*    ASL_MSG_EX_INTERRUPT_LIST_MIN */      "Too few interrupts (1 minimum required)",
124460301d4Schristos /*    ASL_MSG_EX_INTERRUPT_NUMBER */        "Invalid interrupt number (must be 32 bits)",
125460301d4Schristos /*    ASL_MSG_FIELD_ACCESS_WIDTH */         "Access width is greater than region size",
126460301d4Schristos /*    ASL_MSG_FIELD_UNIT_ACCESS_WIDTH */    "Access width of Field Unit extends beyond region limit",
127460301d4Schristos /*    ASL_MSG_FIELD_UNIT_OFFSET */          "Field Unit extends beyond region limit",
128460301d4Schristos /*    ASL_MSG_GPE_NAME_CONFLICT */          "Name conflicts with a previous GPE method",
129460301d4Schristos /*    ASL_MSG_HID_LENGTH */                 "_HID string must be exactly 7 or 8 characters",
130460301d4Schristos /*    ASL_MSG_HID_PREFIX */                 "_HID prefix must be all uppercase or decimal digits",
131460301d4Schristos /*    ASL_MSG_HID_SUFFIX */                 "_HID suffix must be all hex digits",
132460301d4Schristos /*    ASL_MSG_INCLUDE_FILE_OPEN */          "Could not open include file",
133460301d4Schristos /*    ASL_MSG_INPUT_FILE_OPEN */            "Could not open input file",
13489b8eb6cSchristos /*    ASL_MSG_INTEGER_LENGTH */             "Truncating 64-bit constant found in 32-bit table",
135460301d4Schristos /*    ASL_MSG_INTEGER_OPTIMIZATION */       "Integer optimized to single-byte AML opcode",
136460301d4Schristos /*    ASL_MSG_INTERRUPT_LIST */             "Too many interrupts (16 max)",
137460301d4Schristos /*    ASL_MSG_INTERRUPT_NUMBER */           "Invalid interrupt number (must be 0-15)",
138460301d4Schristos /*    ASL_MSG_INVALID_ACCESS_SIZE */        "Invalid AccessSize (Maximum is 4 - QWord access)",
139460301d4Schristos /*    ASL_MSG_INVALID_ADDR_FLAGS */         "Invalid combination of Length and Min/Max fixed flags",
140460301d4Schristos /*    ASL_MSG_INVALID_CONSTANT_OP */        "Invalid operator in constant expression (not type 3/4/5)",
141460301d4Schristos /*    ASL_MSG_INVALID_EISAID */             "EISAID string must be of the form \"UUUXXXX\" (3 uppercase, 4 hex digits)",
142460301d4Schristos /*    ASL_MSG_INVALID_ESCAPE */             "Invalid or unknown escape sequence",
143460301d4Schristos /*    ASL_MSG_INVALID_GRAN_FIXED */         "Granularity must be zero for fixed Min/Max",
144460301d4Schristos /*    ASL_MSG_INVALID_GRANULARITY */        "Granularity must be zero or a power of two minus one",
145460301d4Schristos /*    ASL_MSG_INVALID_LENGTH */             "Length is larger than Min/Max window",
146460301d4Schristos /*    ASL_MSG_INVALID_LENGTH_FIXED */       "Length is not equal to fixed Min/Max window",
147460301d4Schristos /*    ASL_MSG_INVALID_MIN_MAX */            "Address Min is greater than Address Max",
148460301d4Schristos /*    ASL_MSG_INVALID_OPERAND */            "Invalid operand",
149460301d4Schristos /*    ASL_MSG_INVALID_PERFORMANCE */        "Invalid performance/robustness value",
150460301d4Schristos /*    ASL_MSG_INVALID_PRIORITY */           "Invalid priority value",
151460301d4Schristos /*    ASL_MSG_INVALID_STRING */             "Invalid Hex/Octal Escape - Non-ASCII or NULL",
152460301d4Schristos /*    ASL_MSG_INVALID_TARGET */             "Target operand not allowed in constant expression",
153460301d4Schristos /*    ASL_MSG_INVALID_TIME */               "Time parameter too long (255 max)",
154460301d4Schristos /*    ASL_MSG_INVALID_TYPE */               "Invalid type",
155460301d4Schristos /*    ASL_MSG_INVALID_UUID */               "UUID string must be of the form \"aabbccdd-eeff-gghh-iijj-kkllmmnnoopp\"",
156460301d4Schristos /*    ASL_MSG_ISA_ADDRESS */                "Maximum 10-bit ISA address (0x3FF)",
157460301d4Schristos /*    ASL_MSG_LEADING_ASTERISK */           "Invalid leading asterisk",
158460301d4Schristos /*    ASL_MSG_LIST_LENGTH_LONG */           "Initializer list longer than declared package length",
159460301d4Schristos /*    ASL_MSG_LIST_LENGTH_SHORT */          "Initializer list shorter than declared package length",
160460301d4Schristos /*    ASL_MSG_LISTING_FILE_OPEN */          "Could not open listing file",
161460301d4Schristos /*    ASL_MSG_LISTING_FILENAME */           "Could not create listing filename",
162460301d4Schristos /*    ASL_MSG_LOCAL_INIT */                 "Method local variable is not initialized",
163460301d4Schristos /*    ASL_MSG_LOCAL_OUTSIDE_METHOD */       "Local or Arg used outside a control method",
164460301d4Schristos /*    ASL_MSG_LONG_LINE */                  "Splitting long input line",
165460301d4Schristos /*    ASL_MSG_MEMORY_ALLOCATION */          "Memory allocation failure",
166460301d4Schristos /*    ASL_MSG_MISSING_ENDDEPENDENT */       "Missing EndDependentFn() macro in dependent resource list",
167460301d4Schristos /*    ASL_MSG_MISSING_STARTDEPENDENT */     "Missing StartDependentFn() macro in dependent resource list",
168460301d4Schristos /*    ASL_MSG_MULTIPLE_DEFAULT */           "More than one Default statement within Switch construct",
169460301d4Schristos /*    ASL_MSG_MULTIPLE_TYPES */             "Multiple types",
170460301d4Schristos /*    ASL_MSG_NAME_EXISTS */                "Name already exists in scope",
171460301d4Schristos /*    ASL_MSG_NAME_OPTIMIZATION */          "NamePath optimized",
172460301d4Schristos /*    ASL_MSG_NAMED_OBJECT_IN_WHILE */      "Creating a named object in a While loop",
173460301d4Schristos /*    ASL_MSG_NESTED_COMMENT */             "Nested comment found",
174460301d4Schristos /*    ASL_MSG_NO_CASES */                   "No Case statements under Switch",
175460301d4Schristos /*    ASL_MSG_NO_REGION */                  "_REG has no corresponding Operation Region",
176460301d4Schristos /*    ASL_MSG_NO_RETVAL */                  "Called method returns no value",
177460301d4Schristos /*    ASL_MSG_NO_WHILE */                   "No enclosing While statement",
178460301d4Schristos /*    ASL_MSG_NON_ASCII */                  "Invalid characters found in file",
179783af925Schristos /*    ASL_MSG_BUFFER_FIELD_LENGTH */        "Field length must be non-zero",
180460301d4Schristos /*    ASL_MSG_NOT_EXIST */                  "Object does not exist",
1814c4e8184Schristos /*    ASL_MSG_NOT_FOUND */                  "Object not found or not accessible from current scope",
182460301d4Schristos /*    ASL_MSG_NOT_METHOD */                 "Not a control method, cannot invoke",
183460301d4Schristos /*    ASL_MSG_NOT_PARAMETER */              "Not a parameter, used as local only",
184460301d4Schristos /*    ASL_MSG_NOT_REACHABLE */              "Object is not accessible from this scope",
185460301d4Schristos /*    ASL_MSG_NOT_REFERENCED */             "Object is not referenced",
186460301d4Schristos /*    ASL_MSG_NULL_DESCRIPTOR */            "Min/Max/Length/Gran are all zero, but no resource tag",
187460301d4Schristos /*    ASL_MSG_NULL_STRING */                "Invalid zero-length (null) string",
188460301d4Schristos /*    ASL_MSG_OPEN */                       "Could not open file",
189460301d4Schristos /*    ASL_MSG_OUTPUT_FILE_OPEN */           "Could not open output AML file",
190460301d4Schristos /*    ASL_MSG_OUTPUT_FILENAME */            "Could not create output filename",
191460301d4Schristos /*    ASL_MSG_PACKAGE_LENGTH */             "Effective AML package length is zero",
192460301d4Schristos /*    ASL_MSG_PREPROCESSOR_FILENAME */      "Could not create preprocessor filename",
193460301d4Schristos /*    ASL_MSG_READ */                       "Could not read file",
194460301d4Schristos /*    ASL_MSG_RECURSION */                  "Recursive method call",
195460301d4Schristos /*    ASL_MSG_REGION_BUFFER_ACCESS */       "Host Operation Region requires BufferAcc access",
196460301d4Schristos /*    ASL_MSG_REGION_BYTE_ACCESS */         "Host Operation Region requires ByteAcc access",
197460301d4Schristos /*    ASL_MSG_RESERVED_ARG_COUNT_HI */      "Reserved method has too many arguments",
198460301d4Schristos /*    ASL_MSG_RESERVED_ARG_COUNT_LO */      "Reserved method has too few arguments",
199460301d4Schristos /*    ASL_MSG_RESERVED_METHOD */            "Reserved name must be a control method",
200460301d4Schristos /*    ASL_MSG_RESERVED_NO_RETURN_VAL */     "Reserved method should not return a value",
201460301d4Schristos /*    ASL_MSG_RESERVED_OPERAND_TYPE */      "Invalid object type for reserved name",
202460301d4Schristos /*    ASL_MSG_RESERVED_PACKAGE_LENGTH */    "Invalid package length for reserved name",
203460301d4Schristos /*    ASL_MSG_RESERVED_RETURN_VALUE */      "Reserved method must return a value",
204460301d4Schristos /*    ASL_MSG_RESERVED_USE */               "Invalid use of reserved name",
205460301d4Schristos /*    ASL_MSG_RESERVED_WORD */              "Use of reserved name",
206460301d4Schristos /*    ASL_MSG_RESOURCE_FIELD */             "Resource field name cannot be used as a target",
207460301d4Schristos /*    ASL_MSG_RESOURCE_INDEX */             "Missing ResourceSourceIndex (required)",
208460301d4Schristos /*    ASL_MSG_RESOURCE_LIST */              "Too many resource items (internal error)",
209460301d4Schristos /*    ASL_MSG_RESOURCE_SOURCE */            "Missing ResourceSource string (required)",
210460301d4Schristos /*    ASL_MSG_RESULT_NOT_USED */            "Result is not used, operator has no effect",
211460301d4Schristos /*    ASL_MSG_RETURN_TYPES */               "Not all control paths return a value",
212460301d4Schristos /*    ASL_MSG_SCOPE_FWD_REF */              "Forward references from Scope operator not allowed",
213460301d4Schristos /*    ASL_MSG_SCOPE_TYPE */                 "Existing object has invalid type for Scope operator",
214460301d4Schristos /*    ASL_MSG_SEEK */                       "Could not seek file",
215460301d4Schristos /*    ASL_MSG_SERIALIZED */                 "Control Method marked Serialized",
2163fd31de5Schristos /*    ASL_MSG_SERIALIZED_REQUIRED */        "Control Method should be made Serialized due to creation of named objects within",
217460301d4Schristos /*    ASL_MSG_SINGLE_NAME_OPTIMIZATION */   "NamePath optimized to NameSeg (uses run-time search path)",
218460301d4Schristos /*    ASL_MSG_SOME_NO_RETVAL */             "Called method may not always return a value",
219460301d4Schristos /*    ASL_MSG_STRING_LENGTH */              "String literal too long",
220460301d4Schristos /*    ASL_MSG_SWITCH_TYPE */                "Switch expression is not a static Integer/Buffer/String data type, defaulting to Integer",
221460301d4Schristos /*    ASL_MSG_SYNC_LEVEL */                 "SyncLevel must be in the range 0-15",
222460301d4Schristos /*    ASL_MSG_SYNTAX */                     "",
223460301d4Schristos /*    ASL_MSG_TABLE_SIGNATURE */            "Invalid Table Signature",
224460301d4Schristos /*    ASL_MSG_TAG_LARGER */                 "ResourceTag larger than Field",
225460301d4Schristos /*    ASL_MSG_TAG_SMALLER */                "ResourceTag smaller than Field",
226460301d4Schristos /*    ASL_MSG_TIMEOUT */                    "Result is not used, possible operator timeout will be missed",
227460301d4Schristos /*    ASL_MSG_TOO_MANY_TEMPS */             "Method requires too many temporary variables (_T_x)",
228cfbb7280Schristos /*    ASL_MSG_TRUNCATION */                 "64-bit return value will be truncated to 32 bits (DSDT or SSDT version < 2)",
229460301d4Schristos /*    ASL_MSG_UNKNOWN_RESERVED_NAME */      "Unknown reserved name",
230460301d4Schristos /*    ASL_MSG_UNREACHABLE_CODE */           "Statement is unreachable",
231460301d4Schristos /*    ASL_MSG_UNSUPPORTED */                "Unsupported feature",
232460301d4Schristos /*    ASL_MSG_UPPER_CASE */                 "Non-hex letters must be upper case",
233460301d4Schristos /*    ASL_MSG_VENDOR_LIST */                "Too many vendor data bytes (7 max)",
234460301d4Schristos /*    ASL_MSG_WRITE */                      "Could not write file",
235460301d4Schristos /*    ASL_MSG_RANGE */                      "Constant out of range",
236460301d4Schristos /*    ASL_MSG_BUFFER_ALLOCATION */          "Could not allocate line buffer",
237460301d4Schristos /*    ASL_MSG_MISSING_DEPENDENCY */         "Missing dependency",
238783af925Schristos /*    ASL_MSG_ILLEGAL_FORWARD_REF */        "Illegal forward reference",
2396c559248Schristos /*    ASL_MSG_ILLEGAL_METHOD_REF */         "Object is declared in a different method",
240c72da027Schristos /*    ASL_MSG_LOCAL_NOT_USED */             "Method Local is set but never used",
241c72da027Schristos /*    ASL_MSG_ARG_AS_LOCAL_NOT_USED */      "Method Argument (as a local) is set but never used",
24271e38f1dSchristos /*    ASL_MSG_ARG_NOT_USED */               "Method Argument is never used",
24371e38f1dSchristos /*    ASL_MSG_CONSTANT_REQUIRED */          "Non-reducible expression",
24489b8eb6cSchristos /*    ASL_MSG_CROSS_TABLE_SCOPE */          "Illegal open scope on external object from within DSDT",
24589b8eb6cSchristos /*    ASL_MSG_EXCEPTION_NOT_RECEIVED */     "Expected remark, warning, or error did not occur. Message ID:",
246b406f703Schristos /*    ASL_MSG_NULL_RESOURCE_TEMPLATE */     "Empty Resource Template (END_TAG only)",
247b406f703Schristos /*    ASL_MSG_FOUND_HERE */                 "Original name creation/declaration below: ",
248062782b3Schristos /*    ASL_MSG_ILLEGAL_RECURSION */          "Illegal recursive call to method that creates named objects",
24994783addSchristos /*    ASL_MSG_DUPLICATE_INPUT_FILE */       "Duplicate input files detected:",
25094783addSchristos /*    ASL_MSG_WARNING_AS_ERROR */           "Warnings detected during compilation",
2516c559248Schristos /*    ASL_MSG_OEM_TABLE_ID */               "Invalid OEM Table ID",
25247315524Schristos /*    ASL_MSG_OEM_ID */                     "Invalid OEM ID",
2534c4e8184Schristos /*    ASL_MSG_UNLOAD */                     "Unload is not supported by all operating systems",
2544c4e8184Schristos /*    ASL_MSG_OFFSET */                     "Unnecessary/redundant use of Offset operator",
2554c4e8184Schristos /*    ASL_MSG_LONG_SLEEP */                 "Very long Sleep, greater than 1 second",
2564c4e8184Schristos /*    ASL_MSG_PREFIX_NOT_EXIST */           "One or more prefix Scopes do not exist",
25794783addSchristos /*    ASL_MSG_NAMEPATH_NOT_EXIST */         "One or more objects within the Pathname do not exist",
25894783addSchristos /*    ASL_MSG_REGION_LENGTH */              "Operation Region declared with zero length",
25994783addSchristos /*    ASL_MSG_TEMPORARY_OBJECT */           "Object is created temporarily in another method and cannot be accessed",
260783af925Schristos /*    ASL_MSG_UNDEFINED_EXTERNAL */         "Named object was declared external but the actual definition does not exist",
261783af925Schristos /*    ASL_MSG_BUFFER_FIELD_OVERFLOW */      "Buffer field extends beyond end of target buffer",
262783af925Schristos /*    ASL_MSG_INVALID_SPECIAL_NAME */       "declaration of this named object outside root scope is illegal",
263783af925Schristos /*    ASL_MSG_INVALID_PROCESSOR_UID */      "_UID inside processor declaration must be an integer",
26432aedd46Schristos /*    ASL_MSG_LEGACY_PROCESSOR_OP */        "Legacy Processor() keyword detected. Use Device() keyword instead.",
26532aedd46Schristos /*    ASL_MSG_NAMESTRING_LENGTH */          "NameString contains too many NameSegs (>255)",
2663fd31de5Schristos /*    ASL_MSG_CASE_FOUND_HERE */            "Original Case value below:",
2673fd31de5Schristos /*    ASL_MSG_EXTERN_INVALID_RET_TYPE */    "Return type is only allowed for Externals declared as MethodObj",
2683fd31de5Schristos /*    ASL_MSG_EXTERN_INVALID_PARAM_TYPE */  "Parameter type is only allowed for Externals declared as MethodObj",
2693fd31de5Schristos /*    ASL_MSG_NAMED_OBJECT_CREATION */      "Creation of named objects within a method is highly inefficient, use globals or method local variables instead",
2703fd31de5Schristos /*    ASL_MSG_ARG_COUNT_MISMATCH */         "Method NumArgs count does not match length of ParameterTypes list",
2713fd31de5Schristos /*    ASL_MSG_STATIC_OPREGION_IN_METHOD */  "Static OperationRegion should be declared outside control method",
2723fd31de5Schristos /*    ASL_MSG_DECLARATION_TYPE_MISMATCH */  "Type mismatch between external declaration and actual object declaration detected",
2733fd31de5Schristos /*    ASL_MSG_TYPE_MISMATCH_FOUND_HERE */   "Actual object declaration:",
2743fd31de5Schristos /*    ASL_MSG_DUPLICATE_EXTERN_MISMATCH */  "Type mismatch between multiple external declarations detected",
2753fd31de5Schristos /*    ASL_MSG_DUPLICATE_EXTERN_FOUND_HERE */"Duplicate external declaration:",
27605264742Schristos /*    ASL_MSG_CONDREF_NEEDS_EXTERNAL_DECL */"CondRefOf parameter requires External() declaration",
277360a9019Schristos /*    ASL_MSG_EXTERNAL_FOUND_HERE */        "External declaration below ",
278360a9019Schristos /*    ASL_MSG_LOWER_CASE_NAMESEG */         "At least one lower case letter found in NameSeg, ASL is case insensitive - converting to upper case",
279360a9019Schristos /*    ASL_MSG_LOWER_CASE_NAMEPATH */        "At least one lower case letter found in NamePath, ASL is case insensitive - converting to upper case",
28046a330b4Schristos /*    ASL_MSG_UUID_NOT_FOUND */             "Unknown UUID string",
28146a330b4Schristos /*    ASL_MSG_LEGACY_DDB_TYPE */            "DDBHandleObj has been deprecated along with the Unload operator. DDBHandlObj objects are only used in Unload"
282460301d4Schristos };
283460301d4Schristos 
284460301d4Schristos /* Table compiler */
285460301d4Schristos 
286460301d4Schristos const char                      *AslTableCompilerMsgs [] =
287460301d4Schristos {
288460301d4Schristos /*    ASL_MSG_BUFFER_ELEMENT */             "Invalid element in buffer initializer list",
289460301d4Schristos /*    ASL_MSG_DIVIDE_BY_ZERO */             "Expression contains divide-by-zero",
290460301d4Schristos /*    ASL_MSG_FLAG_VALUE */                 "Flag value is too large",
291460301d4Schristos /*    ASL_MSG_INTEGER_SIZE */               "Integer too large for target",
292460301d4Schristos /*    ASL_MSG_INVALID_EXPRESSION */         "Invalid expression",
293460301d4Schristos /*    ASL_MSG_INVALID_FIELD_NAME */         "Invalid Field Name",
294460301d4Schristos /*    ASL_MSG_INVALID_HEX_INTEGER */        "Invalid hex integer constant",
295460301d4Schristos /*    ASL_MSG_OEM_TABLE */                  "OEM table - unknown contents",
2963e9809d7Schristos /*    ASL_MSG_RESERVED_FIELD */             "Reserved field",
297460301d4Schristos /*    ASL_MSG_UNKNOWN_LABEL */              "Label is undefined",
298460301d4Schristos /*    ASL_MSG_UNKNOWN_SUBTABLE */           "Unknown subtable type",
299460301d4Schristos /*    ASL_MSG_UNKNOWN_TABLE */              "Unknown ACPI table signature",
30032aedd46Schristos /*    ASL_MSG_ZERO_VALUE */                 "Value must be non-zero",
30132aedd46Schristos /*    ASL_MSG_INVALID_LABEL */              "Invalid field label detected",
30232aedd46Schristos /*    ASL_MSG_BUFFER_LIST */                "Invalid buffer initializer list",
3033e9809d7Schristos /*    ASL_MSG_ENTRY_LIST */                 "Invalid entry initializer list",
3043e9809d7Schristos /*    ASL_MSG_UNKNOWN_FORMAT */             "Unknown format value",
3053e9809d7Schristos /*    ASL_MSG_RESERVED_VALUE */             "Value for field is reserved or unknown",
3068a8be6c4Schristos /*    ASL_MSG_TWO_ZERO_VALUES */            "32-bit DSDT Address and 64-bit X_DSDT Address cannot both be zero",
3078a8be6c4Schristos /*    ASL_MSG_BAD_PARSE_TREE */             "Parse tree appears to be ill-defined"
308460301d4Schristos };
309460301d4Schristos 
310460301d4Schristos /* Preprocessor */
311460301d4Schristos 
312460301d4Schristos const char                      *AslPreprocessorMsgs [] =
313460301d4Schristos {
314460301d4Schristos /*    ASL_MSG_DIRECTIVE_SYNTAX */           "Invalid directive syntax",
315460301d4Schristos /*    ASL_MSG_ENDIF_MISMATCH */             "Mismatched #endif",
316460301d4Schristos /*    ASL_MSG_ERROR_DIRECTIVE */            "#error",
317460301d4Schristos /*    ASL_MSG_EXISTING_NAME */              "Name is already defined",
318460301d4Schristos /*    ASL_MSG_INVALID_INVOCATION */         "Invalid macro invocation",
319460301d4Schristos /*    ASL_MSG_MACRO_SYNTAX */               "Invalid macro syntax",
320460301d4Schristos /*    ASL_MSG_TOO_MANY_ARGUMENTS */         "Too many macro arguments",
321460301d4Schristos /*    ASL_MSG_UNKNOWN_DIRECTIVE */          "Unknown directive",
322460301d4Schristos /*    ASL_MSG_UNKNOWN_PRAGMA */             "Unknown pragma",
323c72da027Schristos /*    ASL_MSG_WARNING_DIRECTIVE */          "#warning",
324c72da027Schristos /*    ASL_MSG_INCLUDE_FILE */               "Found a # preprocessor directive in ASL Include() file"
325460301d4Schristos };
326460301d4Schristos 
327460301d4Schristos 
328460301d4Schristos /*******************************************************************************
329460301d4Schristos  *
330460301d4Schristos  * FUNCTION:    AeDecodeMessageId
331460301d4Schristos  *
332460301d4Schristos  * PARAMETERS:  MessageId               - ASL message ID (exception code) to be
333460301d4Schristos  *                                        formatted. Possibly fully encoded.
334460301d4Schristos  *
335460301d4Schristos  * RETURN:      A string containing the exception message text.
336460301d4Schristos  *
337460301d4Schristos  * DESCRIPTION: This function validates and translates an ASL message ID into
338460301d4Schristos  *              an ASCII string.
339460301d4Schristos  *
340460301d4Schristos  ******************************************************************************/
341460301d4Schristos 
342460301d4Schristos const char *
AeDecodeMessageId(UINT16 MessageId)343460301d4Schristos AeDecodeMessageId (
344460301d4Schristos     UINT16                  MessageId)
345460301d4Schristos {
346460301d4Schristos     UINT32                  Index;
347460301d4Schristos     const char              **MessageTable;
348460301d4Schristos 
349460301d4Schristos 
350460301d4Schristos     /* Main ASL Compiler messages */
351460301d4Schristos 
352460301d4Schristos     if (MessageId <= ASL_MSG_MAIN_COMPILER_END)
353460301d4Schristos     {
354460301d4Schristos         MessageTable = AslCompilerMsgs;
355460301d4Schristos         Index = MessageId;
356460301d4Schristos 
357460301d4Schristos         if (Index >= ACPI_ARRAY_LENGTH (AslCompilerMsgs))
358460301d4Schristos         {
359360a9019Schristos             return ("[Unknown iASL Compiler exception ID]");
360460301d4Schristos         }
361460301d4Schristos     }
362460301d4Schristos 
363460301d4Schristos     /* Data Table Compiler messages */
364460301d4Schristos 
365460301d4Schristos     else if (MessageId <= ASL_MSG_TABLE_COMPILER_END)
366460301d4Schristos     {
367460301d4Schristos         MessageTable = AslTableCompilerMsgs;
368460301d4Schristos         Index = MessageId - ASL_MSG_TABLE_COMPILER;
369460301d4Schristos 
370460301d4Schristos         if (Index >= ACPI_ARRAY_LENGTH (AslTableCompilerMsgs))
371460301d4Schristos         {
372360a9019Schristos             return ("[Unknown iASL Table Compiler exception ID]");
373460301d4Schristos         }
374460301d4Schristos     }
375460301d4Schristos 
376460301d4Schristos     /* Preprocessor messages */
377460301d4Schristos 
378460301d4Schristos     else if (MessageId <= ASL_MSG_PREPROCESSOR_END)
379460301d4Schristos     {
380460301d4Schristos         MessageTable = AslPreprocessorMsgs;
381460301d4Schristos         Index = MessageId - ASL_MSG_PREPROCESSOR;
382460301d4Schristos 
383460301d4Schristos         if (Index >= ACPI_ARRAY_LENGTH (AslPreprocessorMsgs))
384460301d4Schristos         {
385360a9019Schristos             return ("[Unknown iASL Preprocessor exception ID]");
386460301d4Schristos         }
387460301d4Schristos     }
388460301d4Schristos 
389460301d4Schristos     /* Everything else is unknown */
390460301d4Schristos 
391460301d4Schristos     else
392460301d4Schristos     {
393360a9019Schristos         return ("[Unknown iASL exception ID]");
394460301d4Schristos     }
395460301d4Schristos 
396460301d4Schristos     return (MessageTable[Index]);
397460301d4Schristos }
398460301d4Schristos 
399460301d4Schristos 
400460301d4Schristos /*******************************************************************************
401460301d4Schristos  *
402460301d4Schristos  * FUNCTION:    AeDecodeExceptionLevel
403460301d4Schristos  *
404460301d4Schristos  * PARAMETERS:  Level               - The ASL error level to be decoded
405460301d4Schristos  *
406460301d4Schristos  * RETURN:      A string containing the error level text
407460301d4Schristos  *
408460301d4Schristos  * DESCRIPTION: This function validates and translates an ASL error level into
409460301d4Schristos  *              an ASCII string.
410460301d4Schristos  *
411460301d4Schristos  ******************************************************************************/
412460301d4Schristos 
413460301d4Schristos const char *
AeDecodeExceptionLevel(UINT8 Level)414460301d4Schristos AeDecodeExceptionLevel (
415460301d4Schristos     UINT8                   Level)
416460301d4Schristos {
417460301d4Schristos     /* Range check on Level */
418460301d4Schristos 
419460301d4Schristos     if (Level >= ACPI_ARRAY_LENGTH (AslErrorLevel))
420460301d4Schristos     {
421460301d4Schristos         return ("Unknown exception level");
422460301d4Schristos     }
423460301d4Schristos 
424460301d4Schristos     /* Differentiate the string type to be used (IDE is all lower case) */
425460301d4Schristos 
4264c4e8184Schristos     if (AslGbl_VerboseErrors)
427460301d4Schristos     {
428460301d4Schristos         return (AslErrorLevel[Level]);
429460301d4Schristos     }
430460301d4Schristos 
431460301d4Schristos     return (AslErrorLevelIde[Level]);
432460301d4Schristos }
433460301d4Schristos 
434460301d4Schristos 
435460301d4Schristos /*******************************************************************************
436460301d4Schristos  *
437460301d4Schristos  * FUNCTION:    AeBuildFullExceptionCode
438460301d4Schristos  *
439460301d4Schristos  * PARAMETERS:  Level               - ASL error level
440460301d4Schristos  *              MessageId           - ASL exception code to be formatted
441460301d4Schristos  *
442460301d4Schristos  * RETURN:      Fully encoded exception code
443460301d4Schristos  *
444460301d4Schristos  * DESCRIPTION: Build the full exception code from the error level and the
445460301d4Schristos  *              actual message ID.
446460301d4Schristos  *
447460301d4Schristos  ******************************************************************************/
448460301d4Schristos 
449460301d4Schristos UINT16
AeBuildFullExceptionCode(UINT8 Level,UINT16 MessageId)450460301d4Schristos AeBuildFullExceptionCode (
451460301d4Schristos     UINT8                   Level,
452460301d4Schristos     UINT16                  MessageId)
453460301d4Schristos {
454460301d4Schristos 
455460301d4Schristos     /*
456460301d4Schristos      * Error level is in the thousands slot (error/warning/remark, etc.)
457460301d4Schristos      * Error codes are 0 - 999
458460301d4Schristos      */
459460301d4Schristos     return (((Level + 1) * 1000) + MessageId);
460460301d4Schristos }
461360a9019Schristos 
462360a9019Schristos 
463360a9019Schristos #ifdef ACPI_HELP_APP
464360a9019Schristos /*******************************************************************************
465360a9019Schristos  *
466360a9019Schristos  * FUNCTION:    AhDecodeAslException
467360a9019Schristos  *
468360a9019Schristos  * PARAMETERS:  HexString           - iASL status string from command line, in
469360a9019Schristos  *                                    hex. If null, display all exceptions.
470360a9019Schristos  *
471360a9019Schristos  * RETURN:      None
472360a9019Schristos  *
473360a9019Schristos  * DESCRIPTION: Decode and display an iASL exception code. Note1: a
474360a9019Schristos  * NULL string for HexString displays all known iASL exceptions. Note2:
475360a9019Schristos  * implements the -x option for AcpiHelp.
476360a9019Schristos  *
477360a9019Schristos  ******************************************************************************/
478360a9019Schristos 
479360a9019Schristos #define AH_DISPLAY_ASL_EXCEPTION_TEXT(Status, Exception) \
480360a9019Schristos     printf ("%.4X: %s\n", Status, Exception)
481360a9019Schristos 
482360a9019Schristos #define AH_DISPLAY_EXCEPTION(Status, Name) \
483360a9019Schristos     printf ("%.4X: %s\n", Status, Name)
484360a9019Schristos 
485360a9019Schristos 
486360a9019Schristos void
AhDecodeAslException(char * HexString)487360a9019Schristos AhDecodeAslException (
488360a9019Schristos     char                    *HexString)
489360a9019Schristos {
490360a9019Schristos     UINT32                  i;
491360a9019Schristos     UINT32                  MessageId;
492360a9019Schristos     const char              *OneException;
493360a9019Schristos     UINT32                  Index = 1;
494360a9019Schristos 
495360a9019Schristos 
496360a9019Schristos     /*
497360a9019Schristos      * A null input string means to decode and display all known
498360a9019Schristos      * exception codes.
499360a9019Schristos      */
500360a9019Schristos     if (!HexString)
501360a9019Schristos     {
502360a9019Schristos         printf ("All defined iASL exception codes:\n\n");
503360a9019Schristos         printf ("Main iASL exceptions:\n\n");
504360a9019Schristos         AH_DISPLAY_EXCEPTION (0,
505360a9019Schristos             "AE_OK                        (No error occurred)");
506360a9019Schristos 
507360a9019Schristos         /* Display codes in each block of exception types */
508360a9019Schristos 
509360a9019Schristos         for (i = 1; Index < ACPI_ARRAY_LENGTH (AslCompilerMsgs); i++, Index++)
510360a9019Schristos         {
511360a9019Schristos             AH_DISPLAY_ASL_EXCEPTION_TEXT (Index, AslCompilerMsgs[i]);
512360a9019Schristos         }
513360a9019Schristos 
514360a9019Schristos         printf ("\niASL Table Compiler exceptions:\n\n");
515360a9019Schristos         Index = ASL_MSG_TABLE_COMPILER;
516360a9019Schristos         for (i = 0; i < ACPI_ARRAY_LENGTH (AslTableCompilerMsgs); i++, Index++)
517360a9019Schristos         {
518360a9019Schristos             AH_DISPLAY_ASL_EXCEPTION_TEXT (Index, AslTableCompilerMsgs[i]);
519360a9019Schristos         }
520360a9019Schristos 
521360a9019Schristos         printf ("\niASL Preprocessor exceptions:\n\n");
522360a9019Schristos         Index = ASL_MSG_PREPROCESSOR;
523360a9019Schristos         for (i = 0; i < ACPI_ARRAY_LENGTH (AslPreprocessorMsgs); i++, Index++)
524360a9019Schristos         {
525360a9019Schristos             AH_DISPLAY_ASL_EXCEPTION_TEXT (Index, AslPreprocessorMsgs[i]);
526360a9019Schristos         }
527360a9019Schristos         return;
528360a9019Schristos     }
529360a9019Schristos 
530360a9019Schristos     /* HexString is valid - convert it to a MessageId and decode it */
531360a9019Schristos 
532360a9019Schristos     MessageId = strtol (HexString, NULL, 16);
533360a9019Schristos     OneException = AeDecodeMessageId ((UINT16) MessageId);
534360a9019Schristos     AH_DISPLAY_ASL_EXCEPTION_TEXT (MessageId, OneException);
535360a9019Schristos }
536360a9019Schristos #endif
537