xref: /freebsd/sys/contrib/dev/acpica/compiler/aslmessages.c (revision 58308fadece25ae4c12bd2f4dce3d73d9c23be43)
1313a0c13SJung-uk Kim /******************************************************************************
2313a0c13SJung-uk Kim  *
3313a0c13SJung-uk Kim  * Module Name: aslmessages.c - Compiler error/warning message strings
4313a0c13SJung-uk Kim  *
5313a0c13SJung-uk Kim  *****************************************************************************/
6313a0c13SJung-uk Kim 
70d84335fSJung-uk Kim /******************************************************************************
80d84335fSJung-uk Kim  *
90d84335fSJung-uk Kim  * 1. Copyright Notice
100d84335fSJung-uk Kim  *
11*58308fadSJung-uk Kim  * Some or all of this work - Copyright (c) 1999 - 2025, Intel Corp.
12313a0c13SJung-uk Kim  * All rights reserved.
13313a0c13SJung-uk Kim  *
140d84335fSJung-uk Kim  * 2. License
150d84335fSJung-uk Kim  *
160d84335fSJung-uk Kim  * 2.1. This is your license from Intel Corp. under its intellectual property
170d84335fSJung-uk Kim  * rights. You may have additional license terms from the party that provided
180d84335fSJung-uk Kim  * you this software, covering your right to use that party's intellectual
190d84335fSJung-uk Kim  * property rights.
200d84335fSJung-uk Kim  *
210d84335fSJung-uk Kim  * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
220d84335fSJung-uk Kim  * copy of the source code appearing in this file ("Covered Code") an
230d84335fSJung-uk Kim  * irrevocable, perpetual, worldwide license under Intel's copyrights in the
240d84335fSJung-uk Kim  * base code distributed originally by Intel ("Original Intel Code") to copy,
250d84335fSJung-uk Kim  * make derivatives, distribute, use and display any portion of the Covered
260d84335fSJung-uk Kim  * Code in any form, with the right to sublicense such rights; and
270d84335fSJung-uk Kim  *
280d84335fSJung-uk Kim  * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
290d84335fSJung-uk Kim  * license (with the right to sublicense), under only those claims of Intel
300d84335fSJung-uk Kim  * patents that are infringed by the Original Intel Code, to make, use, sell,
310d84335fSJung-uk Kim  * offer to sell, and import the Covered Code and derivative works thereof
320d84335fSJung-uk Kim  * solely to the minimum extent necessary to exercise the above copyright
330d84335fSJung-uk Kim  * license, and in no event shall the patent license extend to any additions
340d84335fSJung-uk Kim  * to or modifications of the Original Intel Code. No other license or right
350d84335fSJung-uk Kim  * is granted directly or by implication, estoppel or otherwise;
360d84335fSJung-uk Kim  *
370d84335fSJung-uk Kim  * The above copyright and patent license is granted only if the following
380d84335fSJung-uk Kim  * conditions are met:
390d84335fSJung-uk Kim  *
400d84335fSJung-uk Kim  * 3. Conditions
410d84335fSJung-uk Kim  *
420d84335fSJung-uk Kim  * 3.1. Redistribution of Source with Rights to Further Distribute Source.
430d84335fSJung-uk Kim  * Redistribution of source code of any substantial portion of the Covered
440d84335fSJung-uk Kim  * Code or modification with rights to further distribute source must include
450d84335fSJung-uk Kim  * the above Copyright Notice, the above License, this list of Conditions,
460d84335fSJung-uk Kim  * and the following Disclaimer and Export Compliance provision. In addition,
470d84335fSJung-uk Kim  * Licensee must cause all Covered Code to which Licensee contributes to
480d84335fSJung-uk Kim  * contain a file documenting the changes Licensee made to create that Covered
490d84335fSJung-uk Kim  * Code and the date of any change. Licensee must include in that file the
500d84335fSJung-uk Kim  * documentation of any changes made by any predecessor Licensee. Licensee
510d84335fSJung-uk Kim  * must include a prominent statement that the modification is derived,
520d84335fSJung-uk Kim  * directly or indirectly, from Original Intel Code.
530d84335fSJung-uk Kim  *
540d84335fSJung-uk Kim  * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
550d84335fSJung-uk Kim  * Redistribution of source code of any substantial portion of the Covered
560d84335fSJung-uk Kim  * Code or modification without rights to further distribute source must
570d84335fSJung-uk Kim  * include the following Disclaimer and Export Compliance provision in the
580d84335fSJung-uk Kim  * documentation and/or other materials provided with distribution. In
590d84335fSJung-uk Kim  * addition, Licensee may not authorize further sublicense of source of any
600d84335fSJung-uk Kim  * portion of the Covered Code, and must include terms to the effect that the
610d84335fSJung-uk Kim  * license from Licensee to its licensee is limited to the intellectual
620d84335fSJung-uk Kim  * property embodied in the software Licensee provides to its licensee, and
630d84335fSJung-uk Kim  * not to intellectual property embodied in modifications its licensee may
640d84335fSJung-uk Kim  * make.
650d84335fSJung-uk Kim  *
660d84335fSJung-uk Kim  * 3.3. Redistribution of Executable. Redistribution in executable form of any
670d84335fSJung-uk Kim  * substantial portion of the Covered Code or modification must reproduce the
680d84335fSJung-uk Kim  * above Copyright Notice, and the following Disclaimer and Export Compliance
690d84335fSJung-uk Kim  * provision in the documentation and/or other materials provided with the
700d84335fSJung-uk Kim  * distribution.
710d84335fSJung-uk Kim  *
720d84335fSJung-uk Kim  * 3.4. Intel retains all right, title, and interest in and to the Original
730d84335fSJung-uk Kim  * Intel Code.
740d84335fSJung-uk Kim  *
750d84335fSJung-uk Kim  * 3.5. Neither the name Intel nor any other trademark owned or controlled by
760d84335fSJung-uk Kim  * Intel shall be used in advertising or otherwise to promote the sale, use or
770d84335fSJung-uk Kim  * other dealings in products derived from or relating to the Covered Code
780d84335fSJung-uk Kim  * without prior written authorization from Intel.
790d84335fSJung-uk Kim  *
800d84335fSJung-uk Kim  * 4. Disclaimer and Export Compliance
810d84335fSJung-uk Kim  *
820d84335fSJung-uk Kim  * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
830d84335fSJung-uk Kim  * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
840d84335fSJung-uk Kim  * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
850d84335fSJung-uk Kim  * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
860d84335fSJung-uk Kim  * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
870d84335fSJung-uk Kim  * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
880d84335fSJung-uk Kim  * PARTICULAR PURPOSE.
890d84335fSJung-uk Kim  *
900d84335fSJung-uk Kim  * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
910d84335fSJung-uk Kim  * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
920d84335fSJung-uk Kim  * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
930d84335fSJung-uk Kim  * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
940d84335fSJung-uk Kim  * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
950d84335fSJung-uk Kim  * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
960d84335fSJung-uk Kim  * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
970d84335fSJung-uk Kim  * LIMITED REMEDY.
980d84335fSJung-uk Kim  *
990d84335fSJung-uk Kim  * 4.3. Licensee shall not export, either directly or indirectly, any of this
1000d84335fSJung-uk Kim  * software or system incorporating such software without first obtaining any
1010d84335fSJung-uk Kim  * required license or other approval from the U. S. Department of Commerce or
1020d84335fSJung-uk Kim  * any other agency or department of the United States Government. In the
1030d84335fSJung-uk Kim  * event Licensee exports any such software from the United States or
1040d84335fSJung-uk Kim  * re-exports any such software from a foreign destination, Licensee shall
1050d84335fSJung-uk Kim  * ensure that the distribution and export/re-export of the software is in
1060d84335fSJung-uk Kim  * compliance with all laws, regulations, orders, or other restrictions of the
1070d84335fSJung-uk Kim  * U.S. Export Administration Regulations. Licensee agrees that neither it nor
1080d84335fSJung-uk Kim  * any of its subsidiaries will export/re-export any technical data, process,
1090d84335fSJung-uk Kim  * software, or service, directly or indirectly, to any country for which the
1100d84335fSJung-uk Kim  * United States government or any agency thereof requires an export license,
1110d84335fSJung-uk Kim  * other governmental approval, or letter of assurance, without first obtaining
1120d84335fSJung-uk Kim  * such license, approval or letter.
1130d84335fSJung-uk Kim  *
1140d84335fSJung-uk Kim  *****************************************************************************
1150d84335fSJung-uk Kim  *
1160d84335fSJung-uk Kim  * Alternatively, you may choose to be licensed under the terms of the
1170d84335fSJung-uk Kim  * following license:
1180d84335fSJung-uk Kim  *
119313a0c13SJung-uk Kim  * Redistribution and use in source and binary forms, with or without
120313a0c13SJung-uk Kim  * modification, are permitted provided that the following conditions
121313a0c13SJung-uk Kim  * are met:
122313a0c13SJung-uk Kim  * 1. Redistributions of source code must retain the above copyright
123313a0c13SJung-uk Kim  *    notice, this list of conditions, and the following disclaimer,
124313a0c13SJung-uk Kim  *    without modification.
125313a0c13SJung-uk Kim  * 2. Redistributions in binary form must reproduce at minimum a disclaimer
126313a0c13SJung-uk Kim  *    substantially similar to the "NO WARRANTY" disclaimer below
127313a0c13SJung-uk Kim  *    ("Disclaimer") and any redistribution must be conditioned upon
128313a0c13SJung-uk Kim  *    including a substantially similar Disclaimer requirement for further
129313a0c13SJung-uk Kim  *    binary redistribution.
130313a0c13SJung-uk Kim  * 3. Neither the names of the above-listed copyright holders nor the names
131313a0c13SJung-uk Kim  *    of any contributors may be used to endorse or promote products derived
132313a0c13SJung-uk Kim  *    from this software without specific prior written permission.
133313a0c13SJung-uk Kim  *
1340d84335fSJung-uk Kim  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
1350d84335fSJung-uk Kim  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
1360d84335fSJung-uk Kim  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
1370d84335fSJung-uk Kim  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
1380d84335fSJung-uk Kim  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
1390d84335fSJung-uk Kim  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
1400d84335fSJung-uk Kim  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
1410d84335fSJung-uk Kim  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
1420d84335fSJung-uk Kim  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
1430d84335fSJung-uk Kim  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
1440d84335fSJung-uk Kim  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
1450d84335fSJung-uk Kim  *
1460d84335fSJung-uk Kim  * Alternatively, you may choose to be licensed under the terms of the
147313a0c13SJung-uk Kim  * GNU General Public License ("GPL") version 2 as published by the Free
148313a0c13SJung-uk Kim  * Software Foundation.
149313a0c13SJung-uk Kim  *
1500d84335fSJung-uk Kim  *****************************************************************************/
151313a0c13SJung-uk Kim 
152313a0c13SJung-uk Kim #include <contrib/dev/acpica/compiler/aslcompiler.h>
153313a0c13SJung-uk Kim 
154313a0c13SJung-uk Kim #define _COMPONENT          ACPI_COMPILER
155313a0c13SJung-uk Kim         ACPI_MODULE_NAME    ("aslmessages")
156313a0c13SJung-uk Kim 
157313a0c13SJung-uk Kim 
158313a0c13SJung-uk Kim /*
159313a0c13SJung-uk Kim  * Strings for message reporting levels, must match error
160313a0c13SJung-uk Kim  * type string tables in aslmessages.c
161313a0c13SJung-uk Kim  */
162313a0c13SJung-uk Kim const char              *AslErrorLevel [ASL_NUM_REPORT_LEVELS] = {
163313a0c13SJung-uk Kim     "Optimize",
164313a0c13SJung-uk Kim     "Remark  ",
165313a0c13SJung-uk Kim     "Warning ",
166313a0c13SJung-uk Kim     "Warning ",
167313a0c13SJung-uk Kim     "Warning ",
168313a0c13SJung-uk Kim     "Error   "
169313a0c13SJung-uk Kim };
170313a0c13SJung-uk Kim 
171313a0c13SJung-uk Kim /* All lowercase versions for IDEs */
172313a0c13SJung-uk Kim 
173313a0c13SJung-uk Kim const char              *AslErrorLevelIde [ASL_NUM_REPORT_LEVELS] = {
174313a0c13SJung-uk Kim     "optimize",
175313a0c13SJung-uk Kim     "remark  ",
176313a0c13SJung-uk Kim     "warning ",
177313a0c13SJung-uk Kim     "warning ",
178313a0c13SJung-uk Kim     "warning ",
179313a0c13SJung-uk Kim     "error   "
180313a0c13SJung-uk Kim };
181313a0c13SJung-uk Kim 
182313a0c13SJung-uk Kim 
183313a0c13SJung-uk Kim /*
184313a0c13SJung-uk Kim  * Actual message strings for each compiler message ID. There are currently
185313a0c13SJung-uk Kim  * three distinct blocks of error messages (so that they can be expanded
186313a0c13SJung-uk Kim  * individually):
187313a0c13SJung-uk Kim  *      Main ASL compiler
188313a0c13SJung-uk Kim  *      Data Table compiler
189313a0c13SJung-uk Kim  *      Preprocessor
190313a0c13SJung-uk Kim  *
191313a0c13SJung-uk Kim  * NOTE1: These tables must match the enum list of message IDs in the file
192313a0c13SJung-uk Kim  * aslmessages.h exactly.
193313a0c13SJung-uk Kim  *
194313a0c13SJung-uk Kim  * NOTE2: With the introduction of the -vw option to disable specific messages,
195313a0c13SJung-uk Kim  * new messages should only be added to the end of this list, so that values
196ab71bbb7SJung-uk Kim  * for existing messages are not disturbed. As important, obsolete messages
197ab71bbb7SJung-uk Kim  * cannot be removed from this list, as it will affect the -vw option.
198313a0c13SJung-uk Kim  */
199313a0c13SJung-uk Kim 
200313a0c13SJung-uk Kim /* ASL compiler */
201313a0c13SJung-uk Kim 
202313a0c13SJung-uk Kim const char                      *AslCompilerMsgs [] =
203313a0c13SJung-uk Kim {
204313a0c13SJung-uk Kim /*    The zeroth message is reserved */    "",
205313a0c13SJung-uk Kim /*    ASL_MSG_ALIGNMENT */                  "Must be a multiple of alignment/granularity value",
206313a0c13SJung-uk Kim /*    ASL_MSG_ALPHANUMERIC_STRING */        "String must be entirely alphanumeric",
207313a0c13SJung-uk Kim /*    ASL_MSG_AML_NOT_IMPLEMENTED */        "Opcode is not implemented in compiler AML code generator",
208313a0c13SJung-uk Kim /*    ASL_MSG_ARG_COUNT_HI */               "Too many arguments",
209313a0c13SJung-uk Kim /*    ASL_MSG_ARG_COUNT_LO */               "Too few arguments",
210313a0c13SJung-uk Kim /*    ASL_MSG_ARG_INIT */                   "Method argument is not initialized",
211313a0c13SJung-uk Kim /*    ASL_MSG_BACKWARDS_OFFSET */           "Invalid backwards offset",
212313a0c13SJung-uk Kim /*    ASL_MSG_BUFFER_LENGTH */              "Effective AML buffer length is zero",
213313a0c13SJung-uk Kim /*    ASL_MSG_CLOSE */                      "Could not close file",
214313a0c13SJung-uk Kim /*    ASL_MSG_COMPILER_INTERNAL */          "Internal compiler error",
215313a0c13SJung-uk Kim /*    ASL_MSG_COMPILER_RESERVED */          "Use of compiler reserved name",
216313a0c13SJung-uk Kim /*    ASL_MSG_CONNECTION_MISSING */         "A Connection operator is required for this field SpaceId",
217313a0c13SJung-uk Kim /*    ASL_MSG_CONNECTION_INVALID */         "Invalid OpRegion SpaceId for use of Connection operator",
218313a0c13SJung-uk Kim /*    ASL_MSG_CONSTANT_EVALUATION */        "Could not evaluate constant expression",
219313a0c13SJung-uk Kim /*    ASL_MSG_CONSTANT_FOLDED */            "Constant expression evaluated and reduced",
220313a0c13SJung-uk Kim /*    ASL_MSG_CORE_EXCEPTION */             "From ACPICA Subsystem",
221313a0c13SJung-uk Kim /*    ASL_MSG_DEBUG_FILE_OPEN */            "Could not open debug file",
222313a0c13SJung-uk Kim /*    ASL_MSG_DEBUG_FILENAME */             "Could not create debug filename",
223313a0c13SJung-uk Kim /*    ASL_MSG_DEPENDENT_NESTING */          "Dependent function macros cannot be nested",
224313a0c13SJung-uk Kim /*    ASL_MSG_DMA_CHANNEL */                "Invalid DMA channel (must be 0-7)",
225313a0c13SJung-uk Kim /*    ASL_MSG_DMA_LIST */                   "Too many DMA channels (8 max)",
226313a0c13SJung-uk Kim /*    ASL_MSG_DUPLICATE_CASE */             "Case value already specified",
227313a0c13SJung-uk Kim /*    ASL_MSG_DUPLICATE_ITEM */             "Duplicate value in list",
228313a0c13SJung-uk Kim /*    ASL_MSG_EARLY_EOF */                  "Premature end-of-file reached",
229313a0c13SJung-uk Kim /*    ASL_MSG_ENCODING_LENGTH */            "Package length too long to encode",
230313a0c13SJung-uk Kim /*    ASL_MSG_EX_INTERRUPT_LIST */          "Too many interrupts (255 max)",
231313a0c13SJung-uk Kim /*    ASL_MSG_EX_INTERRUPT_LIST_MIN */      "Too few interrupts (1 minimum required)",
232313a0c13SJung-uk Kim /*    ASL_MSG_EX_INTERRUPT_NUMBER */        "Invalid interrupt number (must be 32 bits)",
233313a0c13SJung-uk Kim /*    ASL_MSG_FIELD_ACCESS_WIDTH */         "Access width is greater than region size",
234313a0c13SJung-uk Kim /*    ASL_MSG_FIELD_UNIT_ACCESS_WIDTH */    "Access width of Field Unit extends beyond region limit",
235313a0c13SJung-uk Kim /*    ASL_MSG_FIELD_UNIT_OFFSET */          "Field Unit extends beyond region limit",
236313a0c13SJung-uk Kim /*    ASL_MSG_GPE_NAME_CONFLICT */          "Name conflicts with a previous GPE method",
237313a0c13SJung-uk Kim /*    ASL_MSG_HID_LENGTH */                 "_HID string must be exactly 7 or 8 characters",
238313a0c13SJung-uk Kim /*    ASL_MSG_HID_PREFIX */                 "_HID prefix must be all uppercase or decimal digits",
239313a0c13SJung-uk Kim /*    ASL_MSG_HID_SUFFIX */                 "_HID suffix must be all hex digits",
240313a0c13SJung-uk Kim /*    ASL_MSG_INCLUDE_FILE_OPEN */          "Could not open include file",
241313a0c13SJung-uk Kim /*    ASL_MSG_INPUT_FILE_OPEN */            "Could not open input file",
2422f6a1a81SJung-uk Kim /*    ASL_MSG_INTEGER_LENGTH */             "Truncating 64-bit constant found in 32-bit table",
243313a0c13SJung-uk Kim /*    ASL_MSG_INTEGER_OPTIMIZATION */       "Integer optimized to single-byte AML opcode",
244313a0c13SJung-uk Kim /*    ASL_MSG_INTERRUPT_LIST */             "Too many interrupts (16 max)",
245313a0c13SJung-uk Kim /*    ASL_MSG_INTERRUPT_NUMBER */           "Invalid interrupt number (must be 0-15)",
246313a0c13SJung-uk Kim /*    ASL_MSG_INVALID_ACCESS_SIZE */        "Invalid AccessSize (Maximum is 4 - QWord access)",
247313a0c13SJung-uk Kim /*    ASL_MSG_INVALID_ADDR_FLAGS */         "Invalid combination of Length and Min/Max fixed flags",
248313a0c13SJung-uk Kim /*    ASL_MSG_INVALID_CONSTANT_OP */        "Invalid operator in constant expression (not type 3/4/5)",
249313a0c13SJung-uk Kim /*    ASL_MSG_INVALID_EISAID */             "EISAID string must be of the form \"UUUXXXX\" (3 uppercase, 4 hex digits)",
250313a0c13SJung-uk Kim /*    ASL_MSG_INVALID_ESCAPE */             "Invalid or unknown escape sequence",
251313a0c13SJung-uk Kim /*    ASL_MSG_INVALID_GRAN_FIXED */         "Granularity must be zero for fixed Min/Max",
252313a0c13SJung-uk Kim /*    ASL_MSG_INVALID_GRANULARITY */        "Granularity must be zero or a power of two minus one",
253313a0c13SJung-uk Kim /*    ASL_MSG_INVALID_LENGTH */             "Length is larger than Min/Max window",
254313a0c13SJung-uk Kim /*    ASL_MSG_INVALID_LENGTH_FIXED */       "Length is not equal to fixed Min/Max window",
255313a0c13SJung-uk Kim /*    ASL_MSG_INVALID_MIN_MAX */            "Address Min is greater than Address Max",
256313a0c13SJung-uk Kim /*    ASL_MSG_INVALID_OPERAND */            "Invalid operand",
257313a0c13SJung-uk Kim /*    ASL_MSG_INVALID_PERFORMANCE */        "Invalid performance/robustness value",
258313a0c13SJung-uk Kim /*    ASL_MSG_INVALID_PRIORITY */           "Invalid priority value",
259313a0c13SJung-uk Kim /*    ASL_MSG_INVALID_STRING */             "Invalid Hex/Octal Escape - Non-ASCII or NULL",
260313a0c13SJung-uk Kim /*    ASL_MSG_INVALID_TARGET */             "Target operand not allowed in constant expression",
261313a0c13SJung-uk Kim /*    ASL_MSG_INVALID_TIME */               "Time parameter too long (255 max)",
262313a0c13SJung-uk Kim /*    ASL_MSG_INVALID_TYPE */               "Invalid type",
263313a0c13SJung-uk Kim /*    ASL_MSG_INVALID_UUID */               "UUID string must be of the form \"aabbccdd-eeff-gghh-iijj-kkllmmnnoopp\"",
264313a0c13SJung-uk Kim /*    ASL_MSG_ISA_ADDRESS */                "Maximum 10-bit ISA address (0x3FF)",
265313a0c13SJung-uk Kim /*    ASL_MSG_LEADING_ASTERISK */           "Invalid leading asterisk",
266313a0c13SJung-uk Kim /*    ASL_MSG_LIST_LENGTH_LONG */           "Initializer list longer than declared package length",
267313a0c13SJung-uk Kim /*    ASL_MSG_LIST_LENGTH_SHORT */          "Initializer list shorter than declared package length",
268313a0c13SJung-uk Kim /*    ASL_MSG_LISTING_FILE_OPEN */          "Could not open listing file",
269313a0c13SJung-uk Kim /*    ASL_MSG_LISTING_FILENAME */           "Could not create listing filename",
270313a0c13SJung-uk Kim /*    ASL_MSG_LOCAL_INIT */                 "Method local variable is not initialized",
271313a0c13SJung-uk Kim /*    ASL_MSG_LOCAL_OUTSIDE_METHOD */       "Local or Arg used outside a control method",
272313a0c13SJung-uk Kim /*    ASL_MSG_LONG_LINE */                  "Splitting long input line",
273313a0c13SJung-uk Kim /*    ASL_MSG_MEMORY_ALLOCATION */          "Memory allocation failure",
274313a0c13SJung-uk Kim /*    ASL_MSG_MISSING_ENDDEPENDENT */       "Missing EndDependentFn() macro in dependent resource list",
275313a0c13SJung-uk Kim /*    ASL_MSG_MISSING_STARTDEPENDENT */     "Missing StartDependentFn() macro in dependent resource list",
276313a0c13SJung-uk Kim /*    ASL_MSG_MULTIPLE_DEFAULT */           "More than one Default statement within Switch construct",
277313a0c13SJung-uk Kim /*    ASL_MSG_MULTIPLE_TYPES */             "Multiple types",
278313a0c13SJung-uk Kim /*    ASL_MSG_NAME_EXISTS */                "Name already exists in scope",
279313a0c13SJung-uk Kim /*    ASL_MSG_NAME_OPTIMIZATION */          "NamePath optimized",
280313a0c13SJung-uk Kim /*    ASL_MSG_NAMED_OBJECT_IN_WHILE */      "Creating a named object in a While loop",
281313a0c13SJung-uk Kim /*    ASL_MSG_NESTED_COMMENT */             "Nested comment found",
282313a0c13SJung-uk Kim /*    ASL_MSG_NO_CASES */                   "No Case statements under Switch",
283313a0c13SJung-uk Kim /*    ASL_MSG_NO_REGION */                  "_REG has no corresponding Operation Region",
284313a0c13SJung-uk Kim /*    ASL_MSG_NO_RETVAL */                  "Called method returns no value",
285313a0c13SJung-uk Kim /*    ASL_MSG_NO_WHILE */                   "No enclosing While statement",
286313a0c13SJung-uk Kim /*    ASL_MSG_NON_ASCII */                  "Invalid characters found in file",
2879ad8b64eSJung-uk Kim /*    ASL_MSG_BUFFER_FIELD_LENGTH */        "Field length must be non-zero",
288313a0c13SJung-uk Kim /*    ASL_MSG_NOT_EXIST */                  "Object does not exist",
2894a38ee6dSJung-uk Kim /*    ASL_MSG_NOT_FOUND */                  "Object not found or not accessible from current scope",
290313a0c13SJung-uk Kim /*    ASL_MSG_NOT_METHOD */                 "Not a control method, cannot invoke",
291313a0c13SJung-uk Kim /*    ASL_MSG_NOT_PARAMETER */              "Not a parameter, used as local only",
292313a0c13SJung-uk Kim /*    ASL_MSG_NOT_REACHABLE */              "Object is not accessible from this scope",
293313a0c13SJung-uk Kim /*    ASL_MSG_NOT_REFERENCED */             "Object is not referenced",
294313a0c13SJung-uk Kim /*    ASL_MSG_NULL_DESCRIPTOR */            "Min/Max/Length/Gran are all zero, but no resource tag",
295313a0c13SJung-uk Kim /*    ASL_MSG_NULL_STRING */                "Invalid zero-length (null) string",
296313a0c13SJung-uk Kim /*    ASL_MSG_OPEN */                       "Could not open file",
297313a0c13SJung-uk Kim /*    ASL_MSG_OUTPUT_FILE_OPEN */           "Could not open output AML file",
298313a0c13SJung-uk Kim /*    ASL_MSG_OUTPUT_FILENAME */            "Could not create output filename",
299313a0c13SJung-uk Kim /*    ASL_MSG_PACKAGE_LENGTH */             "Effective AML package length is zero",
300313a0c13SJung-uk Kim /*    ASL_MSG_PREPROCESSOR_FILENAME */      "Could not create preprocessor filename",
301313a0c13SJung-uk Kim /*    ASL_MSG_READ */                       "Could not read file",
302313a0c13SJung-uk Kim /*    ASL_MSG_RECURSION */                  "Recursive method call",
303313a0c13SJung-uk Kim /*    ASL_MSG_REGION_BUFFER_ACCESS */       "Host Operation Region requires BufferAcc access",
304313a0c13SJung-uk Kim /*    ASL_MSG_REGION_BYTE_ACCESS */         "Host Operation Region requires ByteAcc access",
305313a0c13SJung-uk Kim /*    ASL_MSG_RESERVED_ARG_COUNT_HI */      "Reserved method has too many arguments",
306313a0c13SJung-uk Kim /*    ASL_MSG_RESERVED_ARG_COUNT_LO */      "Reserved method has too few arguments",
307313a0c13SJung-uk Kim /*    ASL_MSG_RESERVED_METHOD */            "Reserved name must be a control method",
308313a0c13SJung-uk Kim /*    ASL_MSG_RESERVED_NO_RETURN_VAL */     "Reserved method should not return a value",
309313a0c13SJung-uk Kim /*    ASL_MSG_RESERVED_OPERAND_TYPE */      "Invalid object type for reserved name",
310313a0c13SJung-uk Kim /*    ASL_MSG_RESERVED_PACKAGE_LENGTH */    "Invalid package length for reserved name",
311313a0c13SJung-uk Kim /*    ASL_MSG_RESERVED_RETURN_VALUE */      "Reserved method must return a value",
312313a0c13SJung-uk Kim /*    ASL_MSG_RESERVED_USE */               "Invalid use of reserved name",
313313a0c13SJung-uk Kim /*    ASL_MSG_RESERVED_WORD */              "Use of reserved name",
314313a0c13SJung-uk Kim /*    ASL_MSG_RESOURCE_FIELD */             "Resource field name cannot be used as a target",
315313a0c13SJung-uk Kim /*    ASL_MSG_RESOURCE_INDEX */             "Missing ResourceSourceIndex (required)",
316313a0c13SJung-uk Kim /*    ASL_MSG_RESOURCE_LIST */              "Too many resource items (internal error)",
317313a0c13SJung-uk Kim /*    ASL_MSG_RESOURCE_SOURCE */            "Missing ResourceSource string (required)",
318313a0c13SJung-uk Kim /*    ASL_MSG_RESULT_NOT_USED */            "Result is not used, operator has no effect",
319313a0c13SJung-uk Kim /*    ASL_MSG_RETURN_TYPES */               "Not all control paths return a value",
320313a0c13SJung-uk Kim /*    ASL_MSG_SCOPE_FWD_REF */              "Forward references from Scope operator not allowed",
321313a0c13SJung-uk Kim /*    ASL_MSG_SCOPE_TYPE */                 "Existing object has invalid type for Scope operator",
322313a0c13SJung-uk Kim /*    ASL_MSG_SEEK */                       "Could not seek file",
323313a0c13SJung-uk Kim /*    ASL_MSG_SERIALIZED */                 "Control Method marked Serialized",
324ec0234b4SJung-uk Kim /*    ASL_MSG_SERIALIZED_REQUIRED */        "Control Method should be made Serialized due to creation of named objects within",
325313a0c13SJung-uk Kim /*    ASL_MSG_SINGLE_NAME_OPTIMIZATION */   "NamePath optimized to NameSeg (uses run-time search path)",
326313a0c13SJung-uk Kim /*    ASL_MSG_SOME_NO_RETVAL */             "Called method may not always return a value",
327313a0c13SJung-uk Kim /*    ASL_MSG_STRING_LENGTH */              "String literal too long",
328313a0c13SJung-uk Kim /*    ASL_MSG_SWITCH_TYPE */                "Switch expression is not a static Integer/Buffer/String data type, defaulting to Integer",
329313a0c13SJung-uk Kim /*    ASL_MSG_SYNC_LEVEL */                 "SyncLevel must be in the range 0-15",
330313a0c13SJung-uk Kim /*    ASL_MSG_SYNTAX */                     "",
331313a0c13SJung-uk Kim /*    ASL_MSG_TABLE_SIGNATURE */            "Invalid Table Signature",
332313a0c13SJung-uk Kim /*    ASL_MSG_TAG_LARGER */                 "ResourceTag larger than Field",
333313a0c13SJung-uk Kim /*    ASL_MSG_TAG_SMALLER */                "ResourceTag smaller than Field",
334313a0c13SJung-uk Kim /*    ASL_MSG_TIMEOUT */                    "Result is not used, possible operator timeout will be missed",
335313a0c13SJung-uk Kim /*    ASL_MSG_TOO_MANY_TEMPS */             "Method requires too many temporary variables (_T_x)",
336f8146b88SJung-uk Kim /*    ASL_MSG_TRUNCATION */                 "64-bit return value will be truncated to 32 bits (DSDT or SSDT version < 2)",
337313a0c13SJung-uk Kim /*    ASL_MSG_UNKNOWN_RESERVED_NAME */      "Unknown reserved name",
338313a0c13SJung-uk Kim /*    ASL_MSG_UNREACHABLE_CODE */           "Statement is unreachable",
339313a0c13SJung-uk Kim /*    ASL_MSG_UNSUPPORTED */                "Unsupported feature",
340313a0c13SJung-uk Kim /*    ASL_MSG_UPPER_CASE */                 "Non-hex letters must be upper case",
341313a0c13SJung-uk Kim /*    ASL_MSG_VENDOR_LIST */                "Too many vendor data bytes (7 max)",
342313a0c13SJung-uk Kim /*    ASL_MSG_WRITE */                      "Could not write file",
343313a0c13SJung-uk Kim /*    ASL_MSG_RANGE */                      "Constant out of range",
344313a0c13SJung-uk Kim /*    ASL_MSG_BUFFER_ALLOCATION */          "Could not allocate line buffer",
345313a0c13SJung-uk Kim /*    ASL_MSG_MISSING_DEPENDENCY */         "Missing dependency",
3469ad8b64eSJung-uk Kim /*    ASL_MSG_ILLEGAL_FORWARD_REF */        "Illegal forward reference",
347835b56bfSJung-uk Kim /*    ASL_MSG_ILLEGAL_METHOD_REF */         "Object is declared in a different method",
348fe0f0bbbSJung-uk Kim /*    ASL_MSG_LOCAL_NOT_USED */             "Method Local is set but never used",
349fe0f0bbbSJung-uk Kim /*    ASL_MSG_ARG_AS_LOCAL_NOT_USED */      "Method Argument (as a local) is set but never used",
350f8146b88SJung-uk Kim /*    ASL_MSG_ARG_NOT_USED */               "Method Argument is never used",
351f8146b88SJung-uk Kim /*    ASL_MSG_CONSTANT_REQUIRED */          "Non-reducible expression",
3525f9b24faSJung-uk Kim /*    ASL_MSG_CROSS_TABLE_SCOPE */          "Illegal open scope on external object from within DSDT",
3532f6a1a81SJung-uk Kim /*    ASL_MSG_EXCEPTION_NOT_RECEIVED */     "Expected remark, warning, or error did not occur. Message ID:",
35467d9aa44SJung-uk Kim /*    ASL_MSG_NULL_RESOURCE_TEMPLATE */     "Empty Resource Template (END_TAG only)",
35567d9aa44SJung-uk Kim /*    ASL_MSG_FOUND_HERE */                 "Original name creation/declaration below: ",
356ff879b07SJung-uk Kim /*    ASL_MSG_ILLEGAL_RECURSION */          "Illegal recursive call to method that creates named objects",
35744b0f624SJung-uk Kim /*    ASL_MSG_DUPLICATE_INPUT_FILE */       "Duplicate input files detected:",
35844b0f624SJung-uk Kim /*    ASL_MSG_WARNING_AS_ERROR */           "Warnings detected during compilation",
359835b56bfSJung-uk Kim /*    ASL_MSG_OEM_TABLE_ID */               "Invalid OEM Table ID",
360da9b0901SJung-uk Kim /*    ASL_MSG_OEM_ID */                     "Invalid OEM ID",
3616f1f1a63SJung-uk Kim /*    ASL_MSG_UNLOAD */                     "Unload is not supported by all operating systems",
3626f1f1a63SJung-uk Kim /*    ASL_MSG_OFFSET */                     "Unnecessary/redundant use of Offset operator",
3634a38ee6dSJung-uk Kim /*    ASL_MSG_LONG_SLEEP */                 "Very long Sleep, greater than 1 second",
3644a38ee6dSJung-uk Kim /*    ASL_MSG_PREFIX_NOT_EXIST */           "One or more prefix Scopes do not exist",
365cd6518c7SJung-uk Kim /*    ASL_MSG_NAMEPATH_NOT_EXIST */         "One or more objects within the Pathname do not exist",
366cd6518c7SJung-uk Kim /*    ASL_MSG_REGION_LENGTH */              "Operation Region declared with zero length",
36744b0f624SJung-uk Kim /*    ASL_MSG_TEMPORARY_OBJECT */           "Object is created temporarily in another method and cannot be accessed",
3689ad8b64eSJung-uk Kim /*    ASL_MSG_UNDEFINED_EXTERNAL */         "Named object was declared external but the actual definition does not exist",
36937d7a5bcSJung-uk Kim /*    ASL_MSG_BUFFER_FIELD_OVERFLOW */      "Buffer field extends beyond end of target buffer",
370a009b7dcSJung-uk Kim /*    ASL_MSG_INVALID_SPECIAL_NAME */       "declaration of this named object outside root scope is illegal",
371a009b7dcSJung-uk Kim /*    ASL_MSG_INVALID_PROCESSOR_UID */      "_UID inside processor declaration must be an integer",
372f9a6772eSJung-uk Kim /*    ASL_MSG_LEGACY_PROCESSOR_OP */        "Legacy Processor() keyword detected. Use Device() keyword instead.",
373f9a6772eSJung-uk Kim /*    ASL_MSG_NAMESTRING_LENGTH */          "NameString contains too many NameSegs (>255)",
374ec0234b4SJung-uk Kim /*    ASL_MSG_CASE_FOUND_HERE */            "Original Case value below:",
375ec0234b4SJung-uk Kim /*    ASL_MSG_EXTERN_INVALID_RET_TYPE */    "Return type is only allowed for Externals declared as MethodObj",
376ec0234b4SJung-uk Kim /*    ASL_MSG_EXTERN_INVALID_PARAM_TYPE */  "Parameter type is only allowed for Externals declared as MethodObj",
377ec0234b4SJung-uk Kim /*    ASL_MSG_NAMED_OBJECT_CREATION */      "Creation of named objects within a method is highly inefficient, use globals or method local variables instead",
378ec0234b4SJung-uk Kim /*    ASL_MSG_ARG_COUNT_MISMATCH */         "Method NumArgs count does not match length of ParameterTypes list",
379ec0234b4SJung-uk Kim /*    ASL_MSG_STATIC_OPREGION_IN_METHOD */  "Static OperationRegion should be declared outside control method",
380ec0234b4SJung-uk Kim /*    ASL_MSG_DECLARATION_TYPE_MISMATCH */  "Type mismatch between external declaration and actual object declaration detected",
381ec0234b4SJung-uk Kim /*    ASL_MSG_TYPE_MISMATCH_FOUND_HERE */   "Actual object declaration:",
382ec0234b4SJung-uk Kim /*    ASL_MSG_DUPLICATE_EXTERN_MISMATCH */  "Type mismatch between multiple external declarations detected",
383ec0234b4SJung-uk Kim /*    ASL_MSG_DUPLICATE_EXTERN_FOUND_HERE */"Duplicate external declaration:",
38408ddfe86SJung-uk Kim /*    ASL_MSG_CONDREF_NEEDS_EXTERNAL_DECL */"CondRefOf parameter requires External() declaration",
385f15e9afbSJung-uk Kim /*    ASL_MSG_EXTERNAL_FOUND_HERE */        "External declaration below ",
386f15e9afbSJung-uk Kim /*    ASL_MSG_LOWER_CASE_NAMESEG */         "At least one lower case letter found in NameSeg, ASL is case insensitive - converting to upper case",
387f15e9afbSJung-uk Kim /*    ASL_MSG_LOWER_CASE_NAMEPATH */        "At least one lower case letter found in NamePath, ASL is case insensitive - converting to upper case",
388cfd1ed46SJung-uk Kim /*    ASL_MSG_UUID_NOT_FOUND */             "Unknown UUID string",
389cfd1ed46SJung-uk Kim /*    ASL_MSG_LEGACY_DDB_TYPE */            "DDBHandleObj has been deprecated along with the Unload operator. DDBHandlObj objects are only used in Unload"
390313a0c13SJung-uk Kim };
391313a0c13SJung-uk Kim 
392313a0c13SJung-uk Kim /* Table compiler */
393313a0c13SJung-uk Kim 
394313a0c13SJung-uk Kim const char                      *AslTableCompilerMsgs [] =
395313a0c13SJung-uk Kim {
396313a0c13SJung-uk Kim /*    ASL_MSG_BUFFER_ELEMENT */             "Invalid element in buffer initializer list",
397313a0c13SJung-uk Kim /*    ASL_MSG_DIVIDE_BY_ZERO */             "Expression contains divide-by-zero",
398313a0c13SJung-uk Kim /*    ASL_MSG_FLAG_VALUE */                 "Flag value is too large",
399313a0c13SJung-uk Kim /*    ASL_MSG_INTEGER_SIZE */               "Integer too large for target",
400313a0c13SJung-uk Kim /*    ASL_MSG_INVALID_EXPRESSION */         "Invalid expression",
401313a0c13SJung-uk Kim /*    ASL_MSG_INVALID_FIELD_NAME */         "Invalid Field Name",
402313a0c13SJung-uk Kim /*    ASL_MSG_INVALID_HEX_INTEGER */        "Invalid hex integer constant",
403313a0c13SJung-uk Kim /*    ASL_MSG_OEM_TABLE */                  "OEM table - unknown contents",
4041970d693SJung-uk Kim /*    ASL_MSG_RESERVED_FIELD */             "Reserved field",
405313a0c13SJung-uk Kim /*    ASL_MSG_UNKNOWN_LABEL */              "Label is undefined",
406313a0c13SJung-uk Kim /*    ASL_MSG_UNKNOWN_SUBTABLE */           "Unknown subtable type",
407313a0c13SJung-uk Kim /*    ASL_MSG_UNKNOWN_TABLE */              "Unknown ACPI table signature",
408a009b7dcSJung-uk Kim /*    ASL_MSG_ZERO_VALUE */                 "Value must be non-zero",
409a009b7dcSJung-uk Kim /*    ASL_MSG_INVALID_LABEL */              "Invalid field label detected",
410a009b7dcSJung-uk Kim /*    ASL_MSG_BUFFER_LIST */                "Invalid buffer initializer list",
4111970d693SJung-uk Kim /*    ASL_MSG_ENTRY_LIST */                 "Invalid entry initializer list",
4121970d693SJung-uk Kim /*    ASL_MSG_UNKNOWN_FORMAT */             "Unknown format value",
4131970d693SJung-uk Kim /*    ASL_MSG_RESERVED_VALUE */             "Value for field is reserved or unknown",
414ab71bbb7SJung-uk Kim /*    ASL_MSG_TWO_ZERO_VALUES */            "32-bit DSDT Address and 64-bit X_DSDT Address cannot both be zero",
415ab71bbb7SJung-uk Kim /*    ASL_MSG_BAD_PARSE_TREE */             "Parse tree appears to be ill-defined"
416313a0c13SJung-uk Kim };
417313a0c13SJung-uk Kim 
418313a0c13SJung-uk Kim /* Preprocessor */
419313a0c13SJung-uk Kim 
420313a0c13SJung-uk Kim const char                      *AslPreprocessorMsgs [] =
421313a0c13SJung-uk Kim {
422313a0c13SJung-uk Kim /*    ASL_MSG_DIRECTIVE_SYNTAX */           "Invalid directive syntax",
423313a0c13SJung-uk Kim /*    ASL_MSG_ENDIF_MISMATCH */             "Mismatched #endif",
424313a0c13SJung-uk Kim /*    ASL_MSG_ERROR_DIRECTIVE */            "#error",
425313a0c13SJung-uk Kim /*    ASL_MSG_EXISTING_NAME */              "Name is already defined",
426313a0c13SJung-uk Kim /*    ASL_MSG_INVALID_INVOCATION */         "Invalid macro invocation",
427313a0c13SJung-uk Kim /*    ASL_MSG_MACRO_SYNTAX */               "Invalid macro syntax",
428313a0c13SJung-uk Kim /*    ASL_MSG_TOO_MANY_ARGUMENTS */         "Too many macro arguments",
429313a0c13SJung-uk Kim /*    ASL_MSG_UNKNOWN_DIRECTIVE */          "Unknown directive",
430313a0c13SJung-uk Kim /*    ASL_MSG_UNKNOWN_PRAGMA */             "Unknown pragma",
431a371a5fdSJung-uk Kim /*    ASL_MSG_WARNING_DIRECTIVE */          "#warning",
432a371a5fdSJung-uk Kim /*    ASL_MSG_INCLUDE_FILE */               "Found a # preprocessor directive in ASL Include() file"
433313a0c13SJung-uk Kim };
434313a0c13SJung-uk Kim 
435313a0c13SJung-uk Kim 
436313a0c13SJung-uk Kim /*******************************************************************************
437313a0c13SJung-uk Kim  *
438313a0c13SJung-uk Kim  * FUNCTION:    AeDecodeMessageId
439313a0c13SJung-uk Kim  *
440313a0c13SJung-uk Kim  * PARAMETERS:  MessageId               - ASL message ID (exception code) to be
441313a0c13SJung-uk Kim  *                                        formatted. Possibly fully encoded.
442313a0c13SJung-uk Kim  *
443313a0c13SJung-uk Kim  * RETURN:      A string containing the exception message text.
444313a0c13SJung-uk Kim  *
445313a0c13SJung-uk Kim  * DESCRIPTION: This function validates and translates an ASL message ID into
446313a0c13SJung-uk Kim  *              an ASCII string.
447313a0c13SJung-uk Kim  *
448313a0c13SJung-uk Kim  ******************************************************************************/
449313a0c13SJung-uk Kim 
450313a0c13SJung-uk Kim const char *
AeDecodeMessageId(UINT16 MessageId)451313a0c13SJung-uk Kim AeDecodeMessageId (
452313a0c13SJung-uk Kim     UINT16                  MessageId)
453313a0c13SJung-uk Kim {
454313a0c13SJung-uk Kim     UINT32                  Index;
455313a0c13SJung-uk Kim     const char              **MessageTable;
456313a0c13SJung-uk Kim 
457313a0c13SJung-uk Kim 
458313a0c13SJung-uk Kim     /* Main ASL Compiler messages */
459313a0c13SJung-uk Kim 
460313a0c13SJung-uk Kim     if (MessageId <= ASL_MSG_MAIN_COMPILER_END)
461313a0c13SJung-uk Kim     {
462313a0c13SJung-uk Kim         MessageTable = AslCompilerMsgs;
463313a0c13SJung-uk Kim         Index = MessageId;
464313a0c13SJung-uk Kim 
465313a0c13SJung-uk Kim         if (Index >= ACPI_ARRAY_LENGTH (AslCompilerMsgs))
466313a0c13SJung-uk Kim         {
467fbde3477SJung-uk Kim             return ("[Unknown iASL Compiler exception ID]");
468313a0c13SJung-uk Kim         }
469313a0c13SJung-uk Kim     }
470313a0c13SJung-uk Kim 
471313a0c13SJung-uk Kim     /* Data Table Compiler messages */
472313a0c13SJung-uk Kim 
473313a0c13SJung-uk Kim     else if (MessageId <= ASL_MSG_TABLE_COMPILER_END)
474313a0c13SJung-uk Kim     {
475313a0c13SJung-uk Kim         MessageTable = AslTableCompilerMsgs;
476313a0c13SJung-uk Kim         Index = MessageId - ASL_MSG_TABLE_COMPILER;
477313a0c13SJung-uk Kim 
478313a0c13SJung-uk Kim         if (Index >= ACPI_ARRAY_LENGTH (AslTableCompilerMsgs))
479313a0c13SJung-uk Kim         {
480fbde3477SJung-uk Kim             return ("[Unknown iASL Table Compiler exception ID]");
481313a0c13SJung-uk Kim         }
482313a0c13SJung-uk Kim     }
483313a0c13SJung-uk Kim 
484313a0c13SJung-uk Kim     /* Preprocessor messages */
485313a0c13SJung-uk Kim 
486313a0c13SJung-uk Kim     else if (MessageId <= ASL_MSG_PREPROCESSOR_END)
487313a0c13SJung-uk Kim     {
488313a0c13SJung-uk Kim         MessageTable = AslPreprocessorMsgs;
489313a0c13SJung-uk Kim         Index = MessageId - ASL_MSG_PREPROCESSOR;
490313a0c13SJung-uk Kim 
491313a0c13SJung-uk Kim         if (Index >= ACPI_ARRAY_LENGTH (AslPreprocessorMsgs))
492313a0c13SJung-uk Kim         {
493fbde3477SJung-uk Kim             return ("[Unknown iASL Preprocessor exception ID]");
494313a0c13SJung-uk Kim         }
495313a0c13SJung-uk Kim     }
496313a0c13SJung-uk Kim 
497313a0c13SJung-uk Kim     /* Everything else is unknown */
498313a0c13SJung-uk Kim 
499313a0c13SJung-uk Kim     else
500313a0c13SJung-uk Kim     {
501fbde3477SJung-uk Kim         return ("[Unknown iASL exception ID]");
502313a0c13SJung-uk Kim     }
503313a0c13SJung-uk Kim 
504313a0c13SJung-uk Kim     return (MessageTable[Index]);
505313a0c13SJung-uk Kim }
506313a0c13SJung-uk Kim 
507313a0c13SJung-uk Kim 
508313a0c13SJung-uk Kim /*******************************************************************************
509313a0c13SJung-uk Kim  *
510313a0c13SJung-uk Kim  * FUNCTION:    AeDecodeExceptionLevel
511313a0c13SJung-uk Kim  *
512313a0c13SJung-uk Kim  * PARAMETERS:  Level               - The ASL error level to be decoded
513313a0c13SJung-uk Kim  *
514313a0c13SJung-uk Kim  * RETURN:      A string containing the error level text
515313a0c13SJung-uk Kim  *
516313a0c13SJung-uk Kim  * DESCRIPTION: This function validates and translates an ASL error level into
517313a0c13SJung-uk Kim  *              an ASCII string.
518313a0c13SJung-uk Kim  *
519313a0c13SJung-uk Kim  ******************************************************************************/
520313a0c13SJung-uk Kim 
521313a0c13SJung-uk Kim const char *
AeDecodeExceptionLevel(UINT8 Level)522313a0c13SJung-uk Kim AeDecodeExceptionLevel (
523313a0c13SJung-uk Kim     UINT8                   Level)
524313a0c13SJung-uk Kim {
525313a0c13SJung-uk Kim     /* Range check on Level */
526313a0c13SJung-uk Kim 
527313a0c13SJung-uk Kim     if (Level >= ACPI_ARRAY_LENGTH (AslErrorLevel))
528313a0c13SJung-uk Kim     {
529313a0c13SJung-uk Kim         return ("Unknown exception level");
530313a0c13SJung-uk Kim     }
531313a0c13SJung-uk Kim 
532313a0c13SJung-uk Kim     /* Differentiate the string type to be used (IDE is all lower case) */
533313a0c13SJung-uk Kim 
5346f1f1a63SJung-uk Kim     if (AslGbl_VerboseErrors)
535313a0c13SJung-uk Kim     {
536313a0c13SJung-uk Kim         return (AslErrorLevel[Level]);
537313a0c13SJung-uk Kim     }
538313a0c13SJung-uk Kim 
539313a0c13SJung-uk Kim     return (AslErrorLevelIde[Level]);
540313a0c13SJung-uk Kim }
541313a0c13SJung-uk Kim 
542313a0c13SJung-uk Kim 
543313a0c13SJung-uk Kim /*******************************************************************************
544313a0c13SJung-uk Kim  *
545313a0c13SJung-uk Kim  * FUNCTION:    AeBuildFullExceptionCode
546313a0c13SJung-uk Kim  *
547313a0c13SJung-uk Kim  * PARAMETERS:  Level               - ASL error level
548313a0c13SJung-uk Kim  *              MessageId           - ASL exception code to be formatted
549313a0c13SJung-uk Kim  *
550313a0c13SJung-uk Kim  * RETURN:      Fully encoded exception code
551313a0c13SJung-uk Kim  *
552313a0c13SJung-uk Kim  * DESCRIPTION: Build the full exception code from the error level and the
553313a0c13SJung-uk Kim  *              actual message ID.
554313a0c13SJung-uk Kim  *
555313a0c13SJung-uk Kim  ******************************************************************************/
556313a0c13SJung-uk Kim 
557313a0c13SJung-uk Kim UINT16
AeBuildFullExceptionCode(UINT8 Level,UINT16 MessageId)558313a0c13SJung-uk Kim AeBuildFullExceptionCode (
559313a0c13SJung-uk Kim     UINT8                   Level,
560313a0c13SJung-uk Kim     UINT16                  MessageId)
561313a0c13SJung-uk Kim {
562313a0c13SJung-uk Kim 
563313a0c13SJung-uk Kim     /*
564313a0c13SJung-uk Kim      * Error level is in the thousands slot (error/warning/remark, etc.)
565313a0c13SJung-uk Kim      * Error codes are 0 - 999
566313a0c13SJung-uk Kim      */
567313a0c13SJung-uk Kim     return (((Level + 1) * 1000) + MessageId);
568313a0c13SJung-uk Kim }
569fbde3477SJung-uk Kim 
570fbde3477SJung-uk Kim 
571fbde3477SJung-uk Kim #ifdef ACPI_HELP_APP
572fbde3477SJung-uk Kim /*******************************************************************************
573fbde3477SJung-uk Kim  *
574fbde3477SJung-uk Kim  * FUNCTION:    AhDecodeAslException
575fbde3477SJung-uk Kim  *
576fbde3477SJung-uk Kim  * PARAMETERS:  HexString           - iASL status string from command line, in
577fbde3477SJung-uk Kim  *                                    hex. If null, display all exceptions.
578fbde3477SJung-uk Kim  *
579fbde3477SJung-uk Kim  * RETURN:      None
580fbde3477SJung-uk Kim  *
581fbde3477SJung-uk Kim  * DESCRIPTION: Decode and display an iASL exception code. Note1: a
582fbde3477SJung-uk Kim  * NULL string for HexString displays all known iASL exceptions. Note2:
583fbde3477SJung-uk Kim  * implements the -x option for AcpiHelp.
584fbde3477SJung-uk Kim  *
585fbde3477SJung-uk Kim  ******************************************************************************/
586fbde3477SJung-uk Kim 
587fbde3477SJung-uk Kim #define AH_DISPLAY_ASL_EXCEPTION_TEXT(Status, Exception) \
588fbde3477SJung-uk Kim     printf ("%.4X: %s\n", Status, Exception)
589fbde3477SJung-uk Kim 
590fbde3477SJung-uk Kim #define AH_DISPLAY_EXCEPTION(Status, Name) \
591fbde3477SJung-uk Kim     printf ("%.4X: %s\n", Status, Name)
592fbde3477SJung-uk Kim 
593fbde3477SJung-uk Kim 
594fbde3477SJung-uk Kim void
AhDecodeAslException(char * HexString)595fbde3477SJung-uk Kim AhDecodeAslException (
596fbde3477SJung-uk Kim     char                    *HexString)
597fbde3477SJung-uk Kim {
598fbde3477SJung-uk Kim     UINT32                  i;
599fbde3477SJung-uk Kim     UINT32                  MessageId;
600fbde3477SJung-uk Kim     const char              *OneException;
601fbde3477SJung-uk Kim     UINT32                  Index = 1;
602fbde3477SJung-uk Kim 
603fbde3477SJung-uk Kim 
604fbde3477SJung-uk Kim     /*
605fbde3477SJung-uk Kim      * A null input string means to decode and display all known
606fbde3477SJung-uk Kim      * exception codes.
607fbde3477SJung-uk Kim      */
608fbde3477SJung-uk Kim     if (!HexString)
609fbde3477SJung-uk Kim     {
610fbde3477SJung-uk Kim         printf ("All defined iASL exception codes:\n\n");
611fbde3477SJung-uk Kim         printf ("Main iASL exceptions:\n\n");
612fbde3477SJung-uk Kim         AH_DISPLAY_EXCEPTION (0,
613fbde3477SJung-uk Kim             "AE_OK                        (No error occurred)");
614fbde3477SJung-uk Kim 
615fbde3477SJung-uk Kim         /* Display codes in each block of exception types */
616fbde3477SJung-uk Kim 
617fbde3477SJung-uk Kim         for (i = 1; Index < ACPI_ARRAY_LENGTH (AslCompilerMsgs); i++, Index++)
618fbde3477SJung-uk Kim         {
619fbde3477SJung-uk Kim             AH_DISPLAY_ASL_EXCEPTION_TEXT (Index, AslCompilerMsgs[i]);
620fbde3477SJung-uk Kim         }
621fbde3477SJung-uk Kim 
622fbde3477SJung-uk Kim         printf ("\niASL Table Compiler exceptions:\n\n");
623fbde3477SJung-uk Kim         Index = ASL_MSG_TABLE_COMPILER;
624fbde3477SJung-uk Kim         for (i = 0; i < ACPI_ARRAY_LENGTH (AslTableCompilerMsgs); i++, Index++)
625fbde3477SJung-uk Kim         {
626fbde3477SJung-uk Kim             AH_DISPLAY_ASL_EXCEPTION_TEXT (Index, AslTableCompilerMsgs[i]);
627fbde3477SJung-uk Kim         }
628fbde3477SJung-uk Kim 
629fbde3477SJung-uk Kim         printf ("\niASL Preprocessor exceptions:\n\n");
630fbde3477SJung-uk Kim         Index = ASL_MSG_PREPROCESSOR;
631fbde3477SJung-uk Kim         for (i = 0; i < ACPI_ARRAY_LENGTH (AslPreprocessorMsgs); i++, Index++)
632fbde3477SJung-uk Kim         {
633fbde3477SJung-uk Kim             AH_DISPLAY_ASL_EXCEPTION_TEXT (Index, AslPreprocessorMsgs[i]);
634fbde3477SJung-uk Kim         }
635fbde3477SJung-uk Kim         return;
636fbde3477SJung-uk Kim     }
637fbde3477SJung-uk Kim 
638fbde3477SJung-uk Kim     /* HexString is valid - convert it to a MessageId and decode it */
639fbde3477SJung-uk Kim 
640fbde3477SJung-uk Kim     MessageId = strtol (HexString, NULL, 16);
641fbde3477SJung-uk Kim     OneException = AeDecodeMessageId ((UINT16) MessageId);
642fbde3477SJung-uk Kim     AH_DISPLAY_ASL_EXCEPTION_TEXT (MessageId, OneException);
643fbde3477SJung-uk Kim }
644fbde3477SJung-uk Kim #endif
645