xref: /freebsd/sys/contrib/dev/acpica/compiler/aslmessages.c (revision fbde34778ba0ba31fcae99e992f353d989433dba)
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  *
11f425b8beSJung-uk Kim  * Some or all of this work - Copyright (c) 1999 - 2020, 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
196313a0c13SJung-uk Kim  * for existing messages are not disturbed.
197313a0c13SJung-uk Kim  */
198313a0c13SJung-uk Kim 
199313a0c13SJung-uk Kim /* ASL compiler */
200313a0c13SJung-uk Kim 
201313a0c13SJung-uk Kim const char                      *AslCompilerMsgs [] =
202313a0c13SJung-uk Kim {
203313a0c13SJung-uk Kim /*    The zeroth message is reserved */    "",
204313a0c13SJung-uk Kim /*    ASL_MSG_ALIGNMENT */                  "Must be a multiple of alignment/granularity value",
205313a0c13SJung-uk Kim /*    ASL_MSG_ALPHANUMERIC_STRING */        "String must be entirely alphanumeric",
206313a0c13SJung-uk Kim /*    ASL_MSG_AML_NOT_IMPLEMENTED */        "Opcode is not implemented in compiler AML code generator",
207313a0c13SJung-uk Kim /*    ASL_MSG_ARG_COUNT_HI */               "Too many arguments",
208313a0c13SJung-uk Kim /*    ASL_MSG_ARG_COUNT_LO */               "Too few arguments",
209313a0c13SJung-uk Kim /*    ASL_MSG_ARG_INIT */                   "Method argument is not initialized",
210313a0c13SJung-uk Kim /*    ASL_MSG_BACKWARDS_OFFSET */           "Invalid backwards offset",
211313a0c13SJung-uk Kim /*    ASL_MSG_BUFFER_LENGTH */              "Effective AML buffer length is zero",
212313a0c13SJung-uk Kim /*    ASL_MSG_CLOSE */                      "Could not close file",
213313a0c13SJung-uk Kim /*    ASL_MSG_COMPILER_INTERNAL */          "Internal compiler error",
214313a0c13SJung-uk Kim /*    ASL_MSG_COMPILER_RESERVED */          "Use of compiler reserved name",
215313a0c13SJung-uk Kim /*    ASL_MSG_CONNECTION_MISSING */         "A Connection operator is required for this field SpaceId",
216313a0c13SJung-uk Kim /*    ASL_MSG_CONNECTION_INVALID */         "Invalid OpRegion SpaceId for use of Connection operator",
217313a0c13SJung-uk Kim /*    ASL_MSG_CONSTANT_EVALUATION */        "Could not evaluate constant expression",
218313a0c13SJung-uk Kim /*    ASL_MSG_CONSTANT_FOLDED */            "Constant expression evaluated and reduced",
219313a0c13SJung-uk Kim /*    ASL_MSG_CORE_EXCEPTION */             "From ACPICA Subsystem",
220313a0c13SJung-uk Kim /*    ASL_MSG_DEBUG_FILE_OPEN */            "Could not open debug file",
221313a0c13SJung-uk Kim /*    ASL_MSG_DEBUG_FILENAME */             "Could not create debug filename",
222313a0c13SJung-uk Kim /*    ASL_MSG_DEPENDENT_NESTING */          "Dependent function macros cannot be nested",
223313a0c13SJung-uk Kim /*    ASL_MSG_DMA_CHANNEL */                "Invalid DMA channel (must be 0-7)",
224313a0c13SJung-uk Kim /*    ASL_MSG_DMA_LIST */                   "Too many DMA channels (8 max)",
225313a0c13SJung-uk Kim /*    ASL_MSG_DUPLICATE_CASE */             "Case value already specified",
226313a0c13SJung-uk Kim /*    ASL_MSG_DUPLICATE_ITEM */             "Duplicate value in list",
227313a0c13SJung-uk Kim /*    ASL_MSG_EARLY_EOF */                  "Premature end-of-file reached",
228313a0c13SJung-uk Kim /*    ASL_MSG_ENCODING_LENGTH */            "Package length too long to encode",
229313a0c13SJung-uk Kim /*    ASL_MSG_EX_INTERRUPT_LIST */          "Too many interrupts (255 max)",
230313a0c13SJung-uk Kim /*    ASL_MSG_EX_INTERRUPT_LIST_MIN */      "Too few interrupts (1 minimum required)",
231313a0c13SJung-uk Kim /*    ASL_MSG_EX_INTERRUPT_NUMBER */        "Invalid interrupt number (must be 32 bits)",
232313a0c13SJung-uk Kim /*    ASL_MSG_FIELD_ACCESS_WIDTH */         "Access width is greater than region size",
233313a0c13SJung-uk Kim /*    ASL_MSG_FIELD_UNIT_ACCESS_WIDTH */    "Access width of Field Unit extends beyond region limit",
234313a0c13SJung-uk Kim /*    ASL_MSG_FIELD_UNIT_OFFSET */          "Field Unit extends beyond region limit",
235313a0c13SJung-uk Kim /*    ASL_MSG_GPE_NAME_CONFLICT */          "Name conflicts with a previous GPE method",
236313a0c13SJung-uk Kim /*    ASL_MSG_HID_LENGTH */                 "_HID string must be exactly 7 or 8 characters",
237313a0c13SJung-uk Kim /*    ASL_MSG_HID_PREFIX */                 "_HID prefix must be all uppercase or decimal digits",
238313a0c13SJung-uk Kim /*    ASL_MSG_HID_SUFFIX */                 "_HID suffix must be all hex digits",
239313a0c13SJung-uk Kim /*    ASL_MSG_INCLUDE_FILE_OPEN */          "Could not open include file",
240313a0c13SJung-uk Kim /*    ASL_MSG_INPUT_FILE_OPEN */            "Could not open input file",
2412f6a1a81SJung-uk Kim /*    ASL_MSG_INTEGER_LENGTH */             "Truncating 64-bit constant found in 32-bit table",
242313a0c13SJung-uk Kim /*    ASL_MSG_INTEGER_OPTIMIZATION */       "Integer optimized to single-byte AML opcode",
243313a0c13SJung-uk Kim /*    ASL_MSG_INTERRUPT_LIST */             "Too many interrupts (16 max)",
244313a0c13SJung-uk Kim /*    ASL_MSG_INTERRUPT_NUMBER */           "Invalid interrupt number (must be 0-15)",
245313a0c13SJung-uk Kim /*    ASL_MSG_INVALID_ACCESS_SIZE */        "Invalid AccessSize (Maximum is 4 - QWord access)",
246313a0c13SJung-uk Kim /*    ASL_MSG_INVALID_ADDR_FLAGS */         "Invalid combination of Length and Min/Max fixed flags",
247313a0c13SJung-uk Kim /*    ASL_MSG_INVALID_CONSTANT_OP */        "Invalid operator in constant expression (not type 3/4/5)",
248313a0c13SJung-uk Kim /*    ASL_MSG_INVALID_EISAID */             "EISAID string must be of the form \"UUUXXXX\" (3 uppercase, 4 hex digits)",
249313a0c13SJung-uk Kim /*    ASL_MSG_INVALID_ESCAPE */             "Invalid or unknown escape sequence",
250313a0c13SJung-uk Kim /*    ASL_MSG_INVALID_GRAN_FIXED */         "Granularity must be zero for fixed Min/Max",
251313a0c13SJung-uk Kim /*    ASL_MSG_INVALID_GRANULARITY */        "Granularity must be zero or a power of two minus one",
252313a0c13SJung-uk Kim /*    ASL_MSG_INVALID_LENGTH */             "Length is larger than Min/Max window",
253313a0c13SJung-uk Kim /*    ASL_MSG_INVALID_LENGTH_FIXED */       "Length is not equal to fixed Min/Max window",
254313a0c13SJung-uk Kim /*    ASL_MSG_INVALID_MIN_MAX */            "Address Min is greater than Address Max",
255313a0c13SJung-uk Kim /*    ASL_MSG_INVALID_OPERAND */            "Invalid operand",
256313a0c13SJung-uk Kim /*    ASL_MSG_INVALID_PERFORMANCE */        "Invalid performance/robustness value",
257313a0c13SJung-uk Kim /*    ASL_MSG_INVALID_PRIORITY */           "Invalid priority value",
258313a0c13SJung-uk Kim /*    ASL_MSG_INVALID_STRING */             "Invalid Hex/Octal Escape - Non-ASCII or NULL",
259313a0c13SJung-uk Kim /*    ASL_MSG_INVALID_TARGET */             "Target operand not allowed in constant expression",
260313a0c13SJung-uk Kim /*    ASL_MSG_INVALID_TIME */               "Time parameter too long (255 max)",
261313a0c13SJung-uk Kim /*    ASL_MSG_INVALID_TYPE */               "Invalid type",
262313a0c13SJung-uk Kim /*    ASL_MSG_INVALID_UUID */               "UUID string must be of the form \"aabbccdd-eeff-gghh-iijj-kkllmmnnoopp\"",
263313a0c13SJung-uk Kim /*    ASL_MSG_ISA_ADDRESS */                "Maximum 10-bit ISA address (0x3FF)",
264313a0c13SJung-uk Kim /*    ASL_MSG_LEADING_ASTERISK */           "Invalid leading asterisk",
265313a0c13SJung-uk Kim /*    ASL_MSG_LIST_LENGTH_LONG */           "Initializer list longer than declared package length",
266313a0c13SJung-uk Kim /*    ASL_MSG_LIST_LENGTH_SHORT */          "Initializer list shorter than declared package length",
267313a0c13SJung-uk Kim /*    ASL_MSG_LISTING_FILE_OPEN */          "Could not open listing file",
268313a0c13SJung-uk Kim /*    ASL_MSG_LISTING_FILENAME */           "Could not create listing filename",
269313a0c13SJung-uk Kim /*    ASL_MSG_LOCAL_INIT */                 "Method local variable is not initialized",
270313a0c13SJung-uk Kim /*    ASL_MSG_LOCAL_OUTSIDE_METHOD */       "Local or Arg used outside a control method",
271313a0c13SJung-uk Kim /*    ASL_MSG_LONG_LINE */                  "Splitting long input line",
272313a0c13SJung-uk Kim /*    ASL_MSG_MEMORY_ALLOCATION */          "Memory allocation failure",
273313a0c13SJung-uk Kim /*    ASL_MSG_MISSING_ENDDEPENDENT */       "Missing EndDependentFn() macro in dependent resource list",
274313a0c13SJung-uk Kim /*    ASL_MSG_MISSING_STARTDEPENDENT */     "Missing StartDependentFn() macro in dependent resource list",
275313a0c13SJung-uk Kim /*    ASL_MSG_MULTIPLE_DEFAULT */           "More than one Default statement within Switch construct",
276313a0c13SJung-uk Kim /*    ASL_MSG_MULTIPLE_TYPES */             "Multiple types",
277313a0c13SJung-uk Kim /*    ASL_MSG_NAME_EXISTS */                "Name already exists in scope",
278313a0c13SJung-uk Kim /*    ASL_MSG_NAME_OPTIMIZATION */          "NamePath optimized",
279313a0c13SJung-uk Kim /*    ASL_MSG_NAMED_OBJECT_IN_WHILE */      "Creating a named object in a While loop",
280313a0c13SJung-uk Kim /*    ASL_MSG_NESTED_COMMENT */             "Nested comment found",
281313a0c13SJung-uk Kim /*    ASL_MSG_NO_CASES */                   "No Case statements under Switch",
282313a0c13SJung-uk Kim /*    ASL_MSG_NO_REGION */                  "_REG has no corresponding Operation Region",
283313a0c13SJung-uk Kim /*    ASL_MSG_NO_RETVAL */                  "Called method returns no value",
284313a0c13SJung-uk Kim /*    ASL_MSG_NO_WHILE */                   "No enclosing While statement",
285313a0c13SJung-uk Kim /*    ASL_MSG_NON_ASCII */                  "Invalid characters found in file",
2869ad8b64eSJung-uk Kim /*    ASL_MSG_BUFFER_FIELD_LENGTH */        "Field length must be non-zero",
287313a0c13SJung-uk Kim /*    ASL_MSG_NOT_EXIST */                  "Object does not exist",
2884a38ee6dSJung-uk Kim /*    ASL_MSG_NOT_FOUND */                  "Object not found or not accessible from current scope",
289313a0c13SJung-uk Kim /*    ASL_MSG_NOT_METHOD */                 "Not a control method, cannot invoke",
290313a0c13SJung-uk Kim /*    ASL_MSG_NOT_PARAMETER */              "Not a parameter, used as local only",
291313a0c13SJung-uk Kim /*    ASL_MSG_NOT_REACHABLE */              "Object is not accessible from this scope",
292313a0c13SJung-uk Kim /*    ASL_MSG_NOT_REFERENCED */             "Object is not referenced",
293313a0c13SJung-uk Kim /*    ASL_MSG_NULL_DESCRIPTOR */            "Min/Max/Length/Gran are all zero, but no resource tag",
294313a0c13SJung-uk Kim /*    ASL_MSG_NULL_STRING */                "Invalid zero-length (null) string",
295313a0c13SJung-uk Kim /*    ASL_MSG_OPEN */                       "Could not open file",
296313a0c13SJung-uk Kim /*    ASL_MSG_OUTPUT_FILE_OPEN */           "Could not open output AML file",
297313a0c13SJung-uk Kim /*    ASL_MSG_OUTPUT_FILENAME */            "Could not create output filename",
298313a0c13SJung-uk Kim /*    ASL_MSG_PACKAGE_LENGTH */             "Effective AML package length is zero",
299313a0c13SJung-uk Kim /*    ASL_MSG_PREPROCESSOR_FILENAME */      "Could not create preprocessor filename",
300313a0c13SJung-uk Kim /*    ASL_MSG_READ */                       "Could not read file",
301313a0c13SJung-uk Kim /*    ASL_MSG_RECURSION */                  "Recursive method call",
302313a0c13SJung-uk Kim /*    ASL_MSG_REGION_BUFFER_ACCESS */       "Host Operation Region requires BufferAcc access",
303313a0c13SJung-uk Kim /*    ASL_MSG_REGION_BYTE_ACCESS */         "Host Operation Region requires ByteAcc access",
304313a0c13SJung-uk Kim /*    ASL_MSG_RESERVED_ARG_COUNT_HI */      "Reserved method has too many arguments",
305313a0c13SJung-uk Kim /*    ASL_MSG_RESERVED_ARG_COUNT_LO */      "Reserved method has too few arguments",
306313a0c13SJung-uk Kim /*    ASL_MSG_RESERVED_METHOD */            "Reserved name must be a control method",
307313a0c13SJung-uk Kim /*    ASL_MSG_RESERVED_NO_RETURN_VAL */     "Reserved method should not return a value",
308313a0c13SJung-uk Kim /*    ASL_MSG_RESERVED_OPERAND_TYPE */      "Invalid object type for reserved name",
309313a0c13SJung-uk Kim /*    ASL_MSG_RESERVED_PACKAGE_LENGTH */    "Invalid package length for reserved name",
310313a0c13SJung-uk Kim /*    ASL_MSG_RESERVED_RETURN_VALUE */      "Reserved method must return a value",
311313a0c13SJung-uk Kim /*    ASL_MSG_RESERVED_USE */               "Invalid use of reserved name",
312313a0c13SJung-uk Kim /*    ASL_MSG_RESERVED_WORD */              "Use of reserved name",
313313a0c13SJung-uk Kim /*    ASL_MSG_RESOURCE_FIELD */             "Resource field name cannot be used as a target",
314313a0c13SJung-uk Kim /*    ASL_MSG_RESOURCE_INDEX */             "Missing ResourceSourceIndex (required)",
315313a0c13SJung-uk Kim /*    ASL_MSG_RESOURCE_LIST */              "Too many resource items (internal error)",
316313a0c13SJung-uk Kim /*    ASL_MSG_RESOURCE_SOURCE */            "Missing ResourceSource string (required)",
317313a0c13SJung-uk Kim /*    ASL_MSG_RESULT_NOT_USED */            "Result is not used, operator has no effect",
318313a0c13SJung-uk Kim /*    ASL_MSG_RETURN_TYPES */               "Not all control paths return a value",
319313a0c13SJung-uk Kim /*    ASL_MSG_SCOPE_FWD_REF */              "Forward references from Scope operator not allowed",
320313a0c13SJung-uk Kim /*    ASL_MSG_SCOPE_TYPE */                 "Existing object has invalid type for Scope operator",
321313a0c13SJung-uk Kim /*    ASL_MSG_SEEK */                       "Could not seek file",
322313a0c13SJung-uk Kim /*    ASL_MSG_SERIALIZED */                 "Control Method marked Serialized",
323ec0234b4SJung-uk Kim /*    ASL_MSG_SERIALIZED_REQUIRED */        "Control Method should be made Serialized due to creation of named objects within",
324313a0c13SJung-uk Kim /*    ASL_MSG_SINGLE_NAME_OPTIMIZATION */   "NamePath optimized to NameSeg (uses run-time search path)",
325313a0c13SJung-uk Kim /*    ASL_MSG_SOME_NO_RETVAL */             "Called method may not always return a value",
326313a0c13SJung-uk Kim /*    ASL_MSG_STRING_LENGTH */              "String literal too long",
327313a0c13SJung-uk Kim /*    ASL_MSG_SWITCH_TYPE */                "Switch expression is not a static Integer/Buffer/String data type, defaulting to Integer",
328313a0c13SJung-uk Kim /*    ASL_MSG_SYNC_LEVEL */                 "SyncLevel must be in the range 0-15",
329313a0c13SJung-uk Kim /*    ASL_MSG_SYNTAX */                     "",
330313a0c13SJung-uk Kim /*    ASL_MSG_TABLE_SIGNATURE */            "Invalid Table Signature",
331313a0c13SJung-uk Kim /*    ASL_MSG_TAG_LARGER */                 "ResourceTag larger than Field",
332313a0c13SJung-uk Kim /*    ASL_MSG_TAG_SMALLER */                "ResourceTag smaller than Field",
333313a0c13SJung-uk Kim /*    ASL_MSG_TIMEOUT */                    "Result is not used, possible operator timeout will be missed",
334313a0c13SJung-uk Kim /*    ASL_MSG_TOO_MANY_TEMPS */             "Method requires too many temporary variables (_T_x)",
335f8146b88SJung-uk Kim /*    ASL_MSG_TRUNCATION */                 "64-bit return value will be truncated to 32 bits (DSDT or SSDT version < 2)",
336313a0c13SJung-uk Kim /*    ASL_MSG_UNKNOWN_RESERVED_NAME */      "Unknown reserved name",
337313a0c13SJung-uk Kim /*    ASL_MSG_UNREACHABLE_CODE */           "Statement is unreachable",
338313a0c13SJung-uk Kim /*    ASL_MSG_UNSUPPORTED */                "Unsupported feature",
339313a0c13SJung-uk Kim /*    ASL_MSG_UPPER_CASE */                 "Non-hex letters must be upper case",
340313a0c13SJung-uk Kim /*    ASL_MSG_VENDOR_LIST */                "Too many vendor data bytes (7 max)",
341313a0c13SJung-uk Kim /*    ASL_MSG_WRITE */                      "Could not write file",
342313a0c13SJung-uk Kim /*    ASL_MSG_RANGE */                      "Constant out of range",
343313a0c13SJung-uk Kim /*    ASL_MSG_BUFFER_ALLOCATION */          "Could not allocate line buffer",
344313a0c13SJung-uk Kim /*    ASL_MSG_MISSING_DEPENDENCY */         "Missing dependency",
3459ad8b64eSJung-uk Kim /*    ASL_MSG_ILLEGAL_FORWARD_REF */        "Illegal forward reference",
346835b56bfSJung-uk Kim /*    ASL_MSG_ILLEGAL_METHOD_REF */         "Object is declared in a different method",
347fe0f0bbbSJung-uk Kim /*    ASL_MSG_LOCAL_NOT_USED */             "Method Local is set but never used",
348fe0f0bbbSJung-uk Kim /*    ASL_MSG_ARG_AS_LOCAL_NOT_USED */      "Method Argument (as a local) is set but never used",
349f8146b88SJung-uk Kim /*    ASL_MSG_ARG_NOT_USED */               "Method Argument is never used",
350f8146b88SJung-uk Kim /*    ASL_MSG_CONSTANT_REQUIRED */          "Non-reducible expression",
3515f9b24faSJung-uk Kim /*    ASL_MSG_CROSS_TABLE_SCOPE */          "Illegal open scope on external object from within DSDT",
3522f6a1a81SJung-uk Kim /*    ASL_MSG_EXCEPTION_NOT_RECEIVED */     "Expected remark, warning, or error did not occur. Message ID:",
35367d9aa44SJung-uk Kim /*    ASL_MSG_NULL_RESOURCE_TEMPLATE */     "Empty Resource Template (END_TAG only)",
35467d9aa44SJung-uk Kim /*    ASL_MSG_FOUND_HERE */                 "Original name creation/declaration below: ",
355ff879b07SJung-uk Kim /*    ASL_MSG_ILLEGAL_RECURSION */          "Illegal recursive call to method that creates named objects",
35644b0f624SJung-uk Kim /*    ASL_MSG_DUPLICATE_INPUT_FILE */       "Duplicate input files detected:",
35744b0f624SJung-uk Kim /*    ASL_MSG_WARNING_AS_ERROR */           "Warnings detected during compilation",
358835b56bfSJung-uk Kim /*    ASL_MSG_OEM_TABLE_ID */               "Invalid OEM Table ID",
359da9b0901SJung-uk Kim /*    ASL_MSG_OEM_ID */                     "Invalid OEM ID",
3606f1f1a63SJung-uk Kim /*    ASL_MSG_UNLOAD */                     "Unload is not supported by all operating systems",
3616f1f1a63SJung-uk Kim /*    ASL_MSG_OFFSET */                     "Unnecessary/redundant use of Offset operator",
3624a38ee6dSJung-uk Kim /*    ASL_MSG_LONG_SLEEP */                 "Very long Sleep, greater than 1 second",
3634a38ee6dSJung-uk Kim /*    ASL_MSG_PREFIX_NOT_EXIST */           "One or more prefix Scopes do not exist",
364cd6518c7SJung-uk Kim /*    ASL_MSG_NAMEPATH_NOT_EXIST */         "One or more objects within the Pathname do not exist",
365cd6518c7SJung-uk Kim /*    ASL_MSG_REGION_LENGTH */              "Operation Region declared with zero length",
36644b0f624SJung-uk Kim /*    ASL_MSG_TEMPORARY_OBJECT */           "Object is created temporarily in another method and cannot be accessed",
3679ad8b64eSJung-uk Kim /*    ASL_MSG_UNDEFINED_EXTERNAL */         "Named object was declared external but the actual definition does not exist",
36837d7a5bcSJung-uk Kim /*    ASL_MSG_BUFFER_FIELD_OVERFLOW */      "Buffer field extends beyond end of target buffer",
369a009b7dcSJung-uk Kim /*    ASL_MSG_INVALID_SPECIAL_NAME */       "declaration of this named object outside root scope is illegal",
370a009b7dcSJung-uk Kim /*    ASL_MSG_INVALID_PROCESSOR_UID */      "_UID inside processor declaration must be an integer",
371f9a6772eSJung-uk Kim /*    ASL_MSG_LEGACY_PROCESSOR_OP */        "Legacy Processor() keyword detected. Use Device() keyword instead.",
372f9a6772eSJung-uk Kim /*    ASL_MSG_NAMESTRING_LENGTH */          "NameString contains too many NameSegs (>255)",
373ec0234b4SJung-uk Kim /*    ASL_MSG_CASE_FOUND_HERE */            "Original Case value below:",
374ec0234b4SJung-uk Kim /*    ASL_MSG_EXTERN_INVALID_RET_TYPE */    "Return type is only allowed for Externals declared as MethodObj",
375ec0234b4SJung-uk Kim /*    ASL_MSG_EXTERN_INVALID_PARAM_TYPE */  "Parameter type is only allowed for Externals declared as MethodObj",
376ec0234b4SJung-uk Kim /*    ASL_MSG_NAMED_OBJECT_CREATION */      "Creation of named objects within a method is highly inefficient, use globals or method local variables instead",
377ec0234b4SJung-uk Kim /*    ASL_MSG_ARG_COUNT_MISMATCH */         "Method NumArgs count does not match length of ParameterTypes list",
378ec0234b4SJung-uk Kim /*    ASL_MSG_STATIC_OPREGION_IN_METHOD */  "Static OperationRegion should be declared outside control method",
379ec0234b4SJung-uk Kim /*    ASL_MSG_DECLARATION_TYPE_MISMATCH */  "Type mismatch between external declaration and actual object declaration detected",
380ec0234b4SJung-uk Kim /*    ASL_MSG_TYPE_MISMATCH_FOUND_HERE */   "Actual object declaration:",
381ec0234b4SJung-uk Kim /*    ASL_MSG_DUPLICATE_EXTERN_MISMATCH */  "Type mismatch between multiple external declarations detected",
382ec0234b4SJung-uk Kim /*    ASL_MSG_DUPLICATE_EXTERN_FOUND_HERE */"Duplicate external declaration:",
38308ddfe86SJung-uk Kim /*    ASL_MSG_CONDREF_NEEDS_EXTERNAL_DECL */"CondRefOf parameter requires External() declaration",
384f15e9afbSJung-uk Kim /*    ASL_MSG_EXTERNAL_FOUND_HERE */        "External declaration below ",
385f15e9afbSJung-uk Kim /*    ASL_MSG_LOWER_CASE_NAMESEG */         "At least one lower case letter found in NameSeg, ASL is case insensitive - converting to upper case",
386f15e9afbSJung-uk Kim /*    ASL_MSG_LOWER_CASE_NAMEPATH */        "At least one lower case letter found in NamePath, ASL is case insensitive - converting to upper case",
387*fbde3477SJung-uk Kim /*    ASL_MSG_UUID_NOT_FOUND */             "Unknown UUID string"
388313a0c13SJung-uk Kim };
389313a0c13SJung-uk Kim 
390313a0c13SJung-uk Kim /* Table compiler */
391313a0c13SJung-uk Kim 
392313a0c13SJung-uk Kim const char                      *AslTableCompilerMsgs [] =
393313a0c13SJung-uk Kim {
394313a0c13SJung-uk Kim /*    ASL_MSG_BUFFER_ELEMENT */             "Invalid element in buffer initializer list",
395313a0c13SJung-uk Kim /*    ASL_MSG_DIVIDE_BY_ZERO */             "Expression contains divide-by-zero",
396313a0c13SJung-uk Kim /*    ASL_MSG_FLAG_VALUE */                 "Flag value is too large",
397313a0c13SJung-uk Kim /*    ASL_MSG_INTEGER_SIZE */               "Integer too large for target",
398313a0c13SJung-uk Kim /*    ASL_MSG_INVALID_EXPRESSION */         "Invalid expression",
399313a0c13SJung-uk Kim /*    ASL_MSG_INVALID_FIELD_NAME */         "Invalid Field Name",
400313a0c13SJung-uk Kim /*    ASL_MSG_INVALID_HEX_INTEGER */        "Invalid hex integer constant",
401313a0c13SJung-uk Kim /*    ASL_MSG_OEM_TABLE */                  "OEM table - unknown contents",
402313a0c13SJung-uk Kim /*    ASL_MSG_RESERVED_VALUE */             "Reserved field",
403313a0c13SJung-uk Kim /*    ASL_MSG_UNKNOWN_LABEL */              "Label is undefined",
404313a0c13SJung-uk Kim /*    ASL_MSG_UNKNOWN_SUBTABLE */           "Unknown subtable type",
405313a0c13SJung-uk Kim /*    ASL_MSG_UNKNOWN_TABLE */              "Unknown ACPI table signature",
406a009b7dcSJung-uk Kim /*    ASL_MSG_ZERO_VALUE */                 "Value must be non-zero",
407a009b7dcSJung-uk Kim /*    ASL_MSG_INVALID_LABEL */              "Invalid field label detected",
408a009b7dcSJung-uk Kim /*    ASL_MSG_BUFFER_LIST */                "Invalid buffer initializer list",
409a009b7dcSJung-uk Kim /*    ASL_MSG_ENTRY_LIST */                 "Invalid entry initializer list"
410313a0c13SJung-uk Kim };
411313a0c13SJung-uk Kim 
412313a0c13SJung-uk Kim /* Preprocessor */
413313a0c13SJung-uk Kim 
414313a0c13SJung-uk Kim const char                      *AslPreprocessorMsgs [] =
415313a0c13SJung-uk Kim {
416313a0c13SJung-uk Kim /*    ASL_MSG_DIRECTIVE_SYNTAX */           "Invalid directive syntax",
417313a0c13SJung-uk Kim /*    ASL_MSG_ENDIF_MISMATCH */             "Mismatched #endif",
418313a0c13SJung-uk Kim /*    ASL_MSG_ERROR_DIRECTIVE */            "#error",
419313a0c13SJung-uk Kim /*    ASL_MSG_EXISTING_NAME */              "Name is already defined",
420313a0c13SJung-uk Kim /*    ASL_MSG_INVALID_INVOCATION */         "Invalid macro invocation",
421313a0c13SJung-uk Kim /*    ASL_MSG_MACRO_SYNTAX */               "Invalid macro syntax",
422313a0c13SJung-uk Kim /*    ASL_MSG_TOO_MANY_ARGUMENTS */         "Too many macro arguments",
423313a0c13SJung-uk Kim /*    ASL_MSG_UNKNOWN_DIRECTIVE */          "Unknown directive",
424313a0c13SJung-uk Kim /*    ASL_MSG_UNKNOWN_PRAGMA */             "Unknown pragma",
425a371a5fdSJung-uk Kim /*    ASL_MSG_WARNING_DIRECTIVE */          "#warning",
426a371a5fdSJung-uk Kim /*    ASL_MSG_INCLUDE_FILE */               "Found a # preprocessor directive in ASL Include() file"
427313a0c13SJung-uk Kim };
428313a0c13SJung-uk Kim 
429313a0c13SJung-uk Kim 
430313a0c13SJung-uk Kim /*******************************************************************************
431313a0c13SJung-uk Kim  *
432313a0c13SJung-uk Kim  * FUNCTION:    AeDecodeMessageId
433313a0c13SJung-uk Kim  *
434313a0c13SJung-uk Kim  * PARAMETERS:  MessageId               - ASL message ID (exception code) to be
435313a0c13SJung-uk Kim  *                                        formatted. Possibly fully encoded.
436313a0c13SJung-uk Kim  *
437313a0c13SJung-uk Kim  * RETURN:      A string containing the exception message text.
438313a0c13SJung-uk Kim  *
439313a0c13SJung-uk Kim  * DESCRIPTION: This function validates and translates an ASL message ID into
440313a0c13SJung-uk Kim  *              an ASCII string.
441313a0c13SJung-uk Kim  *
442313a0c13SJung-uk Kim  ******************************************************************************/
443313a0c13SJung-uk Kim 
444313a0c13SJung-uk Kim const char *
445313a0c13SJung-uk Kim AeDecodeMessageId (
446313a0c13SJung-uk Kim     UINT16                  MessageId)
447313a0c13SJung-uk Kim {
448313a0c13SJung-uk Kim     UINT32                  Index;
449313a0c13SJung-uk Kim     const char              **MessageTable;
450313a0c13SJung-uk Kim 
451313a0c13SJung-uk Kim 
452313a0c13SJung-uk Kim     /* Main ASL Compiler messages */
453313a0c13SJung-uk Kim 
454313a0c13SJung-uk Kim     if (MessageId <= ASL_MSG_MAIN_COMPILER_END)
455313a0c13SJung-uk Kim     {
456313a0c13SJung-uk Kim         MessageTable = AslCompilerMsgs;
457313a0c13SJung-uk Kim         Index = MessageId;
458313a0c13SJung-uk Kim 
459313a0c13SJung-uk Kim         if (Index >= ACPI_ARRAY_LENGTH (AslCompilerMsgs))
460313a0c13SJung-uk Kim         {
461*fbde3477SJung-uk Kim             return ("[Unknown iASL Compiler exception ID]");
462313a0c13SJung-uk Kim         }
463313a0c13SJung-uk Kim     }
464313a0c13SJung-uk Kim 
465313a0c13SJung-uk Kim     /* Data Table Compiler messages */
466313a0c13SJung-uk Kim 
467313a0c13SJung-uk Kim     else if (MessageId <= ASL_MSG_TABLE_COMPILER_END)
468313a0c13SJung-uk Kim     {
469313a0c13SJung-uk Kim         MessageTable = AslTableCompilerMsgs;
470313a0c13SJung-uk Kim         Index = MessageId - ASL_MSG_TABLE_COMPILER;
471313a0c13SJung-uk Kim 
472313a0c13SJung-uk Kim         if (Index >= ACPI_ARRAY_LENGTH (AslTableCompilerMsgs))
473313a0c13SJung-uk Kim         {
474*fbde3477SJung-uk Kim             return ("[Unknown iASL Table Compiler exception ID]");
475313a0c13SJung-uk Kim         }
476313a0c13SJung-uk Kim     }
477313a0c13SJung-uk Kim 
478313a0c13SJung-uk Kim     /* Preprocessor messages */
479313a0c13SJung-uk Kim 
480313a0c13SJung-uk Kim     else if (MessageId <= ASL_MSG_PREPROCESSOR_END)
481313a0c13SJung-uk Kim     {
482313a0c13SJung-uk Kim         MessageTable = AslPreprocessorMsgs;
483313a0c13SJung-uk Kim         Index = MessageId - ASL_MSG_PREPROCESSOR;
484313a0c13SJung-uk Kim 
485313a0c13SJung-uk Kim         if (Index >= ACPI_ARRAY_LENGTH (AslPreprocessorMsgs))
486313a0c13SJung-uk Kim         {
487*fbde3477SJung-uk Kim             return ("[Unknown iASL Preprocessor exception ID]");
488313a0c13SJung-uk Kim         }
489313a0c13SJung-uk Kim     }
490313a0c13SJung-uk Kim 
491313a0c13SJung-uk Kim     /* Everything else is unknown */
492313a0c13SJung-uk Kim 
493313a0c13SJung-uk Kim     else
494313a0c13SJung-uk Kim     {
495*fbde3477SJung-uk Kim         return ("[Unknown iASL exception ID]");
496313a0c13SJung-uk Kim     }
497313a0c13SJung-uk Kim 
498313a0c13SJung-uk Kim     return (MessageTable[Index]);
499313a0c13SJung-uk Kim }
500313a0c13SJung-uk Kim 
501313a0c13SJung-uk Kim 
502313a0c13SJung-uk Kim /*******************************************************************************
503313a0c13SJung-uk Kim  *
504313a0c13SJung-uk Kim  * FUNCTION:    AeDecodeExceptionLevel
505313a0c13SJung-uk Kim  *
506313a0c13SJung-uk Kim  * PARAMETERS:  Level               - The ASL error level to be decoded
507313a0c13SJung-uk Kim  *
508313a0c13SJung-uk Kim  * RETURN:      A string containing the error level text
509313a0c13SJung-uk Kim  *
510313a0c13SJung-uk Kim  * DESCRIPTION: This function validates and translates an ASL error level into
511313a0c13SJung-uk Kim  *              an ASCII string.
512313a0c13SJung-uk Kim  *
513313a0c13SJung-uk Kim  ******************************************************************************/
514313a0c13SJung-uk Kim 
515313a0c13SJung-uk Kim const char *
516313a0c13SJung-uk Kim AeDecodeExceptionLevel (
517313a0c13SJung-uk Kim     UINT8                   Level)
518313a0c13SJung-uk Kim {
519313a0c13SJung-uk Kim     /* Range check on Level */
520313a0c13SJung-uk Kim 
521313a0c13SJung-uk Kim     if (Level >= ACPI_ARRAY_LENGTH (AslErrorLevel))
522313a0c13SJung-uk Kim     {
523313a0c13SJung-uk Kim         return ("Unknown exception level");
524313a0c13SJung-uk Kim     }
525313a0c13SJung-uk Kim 
526313a0c13SJung-uk Kim     /* Differentiate the string type to be used (IDE is all lower case) */
527313a0c13SJung-uk Kim 
5286f1f1a63SJung-uk Kim     if (AslGbl_VerboseErrors)
529313a0c13SJung-uk Kim     {
530313a0c13SJung-uk Kim         return (AslErrorLevel[Level]);
531313a0c13SJung-uk Kim     }
532313a0c13SJung-uk Kim 
533313a0c13SJung-uk Kim     return (AslErrorLevelIde[Level]);
534313a0c13SJung-uk Kim }
535313a0c13SJung-uk Kim 
536313a0c13SJung-uk Kim 
537313a0c13SJung-uk Kim /*******************************************************************************
538313a0c13SJung-uk Kim  *
539313a0c13SJung-uk Kim  * FUNCTION:    AeBuildFullExceptionCode
540313a0c13SJung-uk Kim  *
541313a0c13SJung-uk Kim  * PARAMETERS:  Level               - ASL error level
542313a0c13SJung-uk Kim  *              MessageId           - ASL exception code to be formatted
543313a0c13SJung-uk Kim  *
544313a0c13SJung-uk Kim  * RETURN:      Fully encoded exception code
545313a0c13SJung-uk Kim  *
546313a0c13SJung-uk Kim  * DESCRIPTION: Build the full exception code from the error level and the
547313a0c13SJung-uk Kim  *              actual message ID.
548313a0c13SJung-uk Kim  *
549313a0c13SJung-uk Kim  ******************************************************************************/
550313a0c13SJung-uk Kim 
551313a0c13SJung-uk Kim UINT16
552313a0c13SJung-uk Kim AeBuildFullExceptionCode (
553313a0c13SJung-uk Kim     UINT8                   Level,
554313a0c13SJung-uk Kim     UINT16                  MessageId)
555313a0c13SJung-uk Kim {
556313a0c13SJung-uk Kim 
557313a0c13SJung-uk Kim     /*
558313a0c13SJung-uk Kim      * Error level is in the thousands slot (error/warning/remark, etc.)
559313a0c13SJung-uk Kim      * Error codes are 0 - 999
560313a0c13SJung-uk Kim      */
561313a0c13SJung-uk Kim     return (((Level + 1) * 1000) + MessageId);
562313a0c13SJung-uk Kim }
563*fbde3477SJung-uk Kim 
564*fbde3477SJung-uk Kim 
565*fbde3477SJung-uk Kim #ifdef ACPI_HELP_APP
566*fbde3477SJung-uk Kim /*******************************************************************************
567*fbde3477SJung-uk Kim  *
568*fbde3477SJung-uk Kim  * FUNCTION:    AhDecodeAslException
569*fbde3477SJung-uk Kim  *
570*fbde3477SJung-uk Kim  * PARAMETERS:  HexString           - iASL status string from command line, in
571*fbde3477SJung-uk Kim  *                                    hex. If null, display all exceptions.
572*fbde3477SJung-uk Kim  *
573*fbde3477SJung-uk Kim  * RETURN:      None
574*fbde3477SJung-uk Kim  *
575*fbde3477SJung-uk Kim  * DESCRIPTION: Decode and display an iASL exception code. Note1: a
576*fbde3477SJung-uk Kim  * NULL string for HexString displays all known iASL exceptions. Note2:
577*fbde3477SJung-uk Kim  * implements the -x option for AcpiHelp.
578*fbde3477SJung-uk Kim  *
579*fbde3477SJung-uk Kim  ******************************************************************************/
580*fbde3477SJung-uk Kim 
581*fbde3477SJung-uk Kim #define AH_DISPLAY_ASL_EXCEPTION_TEXT(Status, Exception) \
582*fbde3477SJung-uk Kim     printf ("%.4X: %s\n", Status, Exception)
583*fbde3477SJung-uk Kim 
584*fbde3477SJung-uk Kim #define AH_DISPLAY_EXCEPTION(Status, Name) \
585*fbde3477SJung-uk Kim     printf ("%.4X: %s\n", Status, Name)
586*fbde3477SJung-uk Kim 
587*fbde3477SJung-uk Kim 
588*fbde3477SJung-uk Kim void
589*fbde3477SJung-uk Kim AhDecodeAslException (
590*fbde3477SJung-uk Kim     char                    *HexString)
591*fbde3477SJung-uk Kim {
592*fbde3477SJung-uk Kim     UINT32                  i;
593*fbde3477SJung-uk Kim     UINT32                  MessageId;
594*fbde3477SJung-uk Kim     const char              *OneException;
595*fbde3477SJung-uk Kim     UINT32                  Index = 1;
596*fbde3477SJung-uk Kim 
597*fbde3477SJung-uk Kim 
598*fbde3477SJung-uk Kim     /*
599*fbde3477SJung-uk Kim      * A null input string means to decode and display all known
600*fbde3477SJung-uk Kim      * exception codes.
601*fbde3477SJung-uk Kim      */
602*fbde3477SJung-uk Kim     if (!HexString)
603*fbde3477SJung-uk Kim     {
604*fbde3477SJung-uk Kim         printf ("All defined iASL exception codes:\n\n");
605*fbde3477SJung-uk Kim         printf ("Main iASL exceptions:\n\n");
606*fbde3477SJung-uk Kim         AH_DISPLAY_EXCEPTION (0,
607*fbde3477SJung-uk Kim             "AE_OK                        (No error occurred)");
608*fbde3477SJung-uk Kim 
609*fbde3477SJung-uk Kim         /* Display codes in each block of exception types */
610*fbde3477SJung-uk Kim 
611*fbde3477SJung-uk Kim         for (i = 1; Index < ACPI_ARRAY_LENGTH (AslCompilerMsgs); i++, Index++)
612*fbde3477SJung-uk Kim         {
613*fbde3477SJung-uk Kim             AH_DISPLAY_ASL_EXCEPTION_TEXT (Index, AslCompilerMsgs[i]);
614*fbde3477SJung-uk Kim         }
615*fbde3477SJung-uk Kim 
616*fbde3477SJung-uk Kim         printf ("\niASL Table Compiler exceptions:\n\n");
617*fbde3477SJung-uk Kim         Index = ASL_MSG_TABLE_COMPILER;
618*fbde3477SJung-uk Kim         for (i = 0; i < ACPI_ARRAY_LENGTH (AslTableCompilerMsgs); i++, Index++)
619*fbde3477SJung-uk Kim         {
620*fbde3477SJung-uk Kim             AH_DISPLAY_ASL_EXCEPTION_TEXT (Index, AslTableCompilerMsgs[i]);
621*fbde3477SJung-uk Kim         }
622*fbde3477SJung-uk Kim 
623*fbde3477SJung-uk Kim         printf ("\niASL Preprocessor exceptions:\n\n");
624*fbde3477SJung-uk Kim         Index = ASL_MSG_PREPROCESSOR;
625*fbde3477SJung-uk Kim         for (i = 0; i < ACPI_ARRAY_LENGTH (AslPreprocessorMsgs); i++, Index++)
626*fbde3477SJung-uk Kim         {
627*fbde3477SJung-uk Kim             AH_DISPLAY_ASL_EXCEPTION_TEXT (Index, AslPreprocessorMsgs[i]);
628*fbde3477SJung-uk Kim         }
629*fbde3477SJung-uk Kim         return;
630*fbde3477SJung-uk Kim     }
631*fbde3477SJung-uk Kim 
632*fbde3477SJung-uk Kim     /* HexString is valid - convert it to a MessageId and decode it */
633*fbde3477SJung-uk Kim 
634*fbde3477SJung-uk Kim     MessageId = strtol (HexString, NULL, 16);
635*fbde3477SJung-uk Kim     OneException = AeDecodeMessageId ((UINT16) MessageId);
636*fbde3477SJung-uk Kim     AH_DISPLAY_ASL_EXCEPTION_TEXT (MessageId, OneException);
637*fbde3477SJung-uk Kim }
638*fbde3477SJung-uk Kim #endif
639