1 /******************************************************************************
3 * Module Name: aslutils -- compiler utilities
5 *****************************************************************************/
7 /******************************************************************************
11 * Some or all of this work - Copyright (c) 1999 - 2017, Intel Corp.
12 * All rights reserved.
16 * 2.1. This is your license from Intel Corp. under its intellectual property
17 * rights. You may have additional license terms from the party that provided
18 * you this software, covering your right to use that party's intellectual
21 * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
22 * copy of the source code appearing in this file ("Covered Code") an
23 * irrevocable, perpetual, worldwide license under Intel's copyrights in the
24 * base code distributed originally by Intel ("Original Intel Code") to copy,
25 * make derivatives, distribute, use and display any portion of the Covered
26 * Code in any form, with the right to sublicense such rights; and
28 * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
29 * license (with the right to sublicense), under only those claims of Intel
30 * patents that are infringed by the Original Intel Code, to make, use, sell,
31 * offer to sell, and import the Covered Code and derivative works thereof
32 * solely to the minimum extent necessary to exercise the above copyright
33 * license, and in no event shall the patent license extend to any additions
34 * to or modifications of the Original Intel Code. No other license or right
35 * is granted directly or by implication, estoppel or otherwise;
37 * The above copyright and patent license is granted only if the following
42 * 3.1. Redistribution of Source with Rights to Further Distribute Source.
43 * Redistribution of source code of any substantial portion of the Covered
44 * Code or modification with rights to further distribute source must include
45 * the above Copyright Notice, the above License, this list of Conditions,
46 * and the following Disclaimer and Export Compliance provision. In addition,
47 * Licensee must cause all Covered Code to which Licensee contributes to
48 * contain a file documenting the changes Licensee made to create that Covered
49 * Code and the date of any change. Licensee must include in that file the
50 * documentation of any changes made by any predecessor Licensee. Licensee
51 * must include a prominent statement that the modification is derived,
52 * directly or indirectly, from Original Intel Code.
54 * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
55 * Redistribution of source code of any substantial portion of the Covered
56 * Code or modification without rights to further distribute source must
57 * include the following Disclaimer and Export Compliance provision in the
58 * documentation and/or other materials provided with distribution. In
59 * addition, Licensee may not authorize further sublicense of source of any
60 * portion of the Covered Code, and must include terms to the effect that the
61 * license from Licensee to its licensee is limited to the intellectual
62 * property embodied in the software Licensee provides to its licensee, and
63 * not to intellectual property embodied in modifications its licensee may
66 * 3.3. Redistribution of Executable. Redistribution in executable form of any
67 * substantial portion of the Covered Code or modification must reproduce the
68 * above Copyright Notice, and the following Disclaimer and Export Compliance
69 * provision in the documentation and/or other materials provided with the
72 * 3.4. Intel retains all right, title, and interest in and to the Original
75 * 3.5. Neither the name Intel nor any other trademark owned or controlled by
76 * Intel shall be used in advertising or otherwise to promote the sale, use or
77 * other dealings in products derived from or relating to the Covered Code
78 * without prior written authorization from Intel.
80 * 4. Disclaimer and Export Compliance
82 * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
83 * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
84 * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
85 * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
86 * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
87 * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
90 * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
91 * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
92 * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
93 * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
94 * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
95 * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
96 * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
99 * 4.3. Licensee shall not export, either directly or indirectly, any of this
100 * software or system incorporating such software without first obtaining any
101 * required license or other approval from the U. S. Department of Commerce or
102 * any other agency or department of the United States Government. In the
103 * event Licensee exports any such software from the United States or
104 * re-exports any such software from a foreign destination, Licensee shall
105 * ensure that the distribution and export/re-export of the software is in
106 * compliance with all laws, regulations, orders, or other restrictions of the
107 * U.S. Export Administration Regulations. Licensee agrees that neither it nor
108 * any of its subsidiaries will export/re-export any technical data, process,
109 * software, or service, directly or indirectly, to any country for which the
110 * United States government or any agency thereof requires an export license,
111 * other governmental approval, or letter of assurance, without first obtaining
112 * such license, approval or letter.
114 *****************************************************************************
116 * Alternatively, you may choose to be licensed under the terms of the
119 * Redistribution and use in source and binary forms, with or without
120 * modification, are permitted provided that the following conditions
122 * 1. Redistributions of source code must retain the above copyright
123 * notice, this list of conditions, and the following disclaimer,
124 * without modification.
125 * 2. Redistributions in binary form must reproduce at minimum a disclaimer
126 * substantially similar to the "NO WARRANTY" disclaimer below
127 * ("Disclaimer") and any redistribution must be conditioned upon
128 * including a substantially similar Disclaimer requirement for further
129 * binary redistribution.
130 * 3. Neither the names of the above-listed copyright holders nor the names
131 * of any contributors may be used to endorse or promote products derived
132 * from this software without specific prior written permission.
134 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
135 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
136 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
137 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
138 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
139 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
140 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
141 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
142 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
143 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
144 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
146 * Alternatively, you may choose to be licensed under the terms of the
147 * GNU General Public License ("GPL") version 2 as published by the Free
148 * Software Foundation.
150 *****************************************************************************/
152 #include <contrib/dev/acpica/compiler/aslcompiler.h>
153 #include "aslcompiler.y.h"
154 #include <contrib/dev/acpica/include/acdisasm.h>
155 #include <contrib/dev/acpica/include/acnamesp.h>
156 #include <contrib/dev/acpica/include/amlcode.h>
157 #include <contrib/dev/acpica/include/acapps.h>
158 #include <sys/stat.h>
161 #define _COMPONENT ACPI_COMPILER
162 ACPI_MODULE_NAME ("aslutils")
165 /* Local prototypes */
168 UtPadNameWithUnderscores (
170 char *PaddedNameSeg);
174 ACPI_PARSE_OBJECT *Op,
178 /*******************************************************************************
180 * FUNCTION: UtIsBigEndianMachine
184 * RETURN: TRUE if machine is big endian
185 * FALSE if machine is little endian
187 * DESCRIPTION: Detect whether machine is little endian or big endian.
189 ******************************************************************************/
192 UtIsBigEndianMachine (
198 } Overlay = {0xFF000000};
201 return (Overlay.Bytes[0]); /* Returns 0xFF (TRUE) for big endian */
205 /******************************************************************************
207 * FUNCTION: UtQueryForOverwrite
209 * PARAMETERS: Pathname - Output filename
211 * RETURN: TRUE if file does not exist or overwrite is authorized
213 * DESCRIPTION: Query for file overwrite if it already exists.
215 ******************************************************************************/
218 UtQueryForOverwrite (
221 struct stat StatInfo;
224 if (!stat (Pathname, &StatInfo))
226 fprintf (stderr, "Target file \"%s\" already exists, overwrite? [y|n] ",
229 if (getchar () != 'y')
239 /*******************************************************************************
241 * FUNCTION: UtDisplaySupportedTables
247 * DESCRIPTION: Print all supported ACPI table names.
249 ******************************************************************************/
252 UtDisplaySupportedTables (
255 const AH_TABLE *TableData;
259 printf ("\nACPI tables supported by iASL version %8.8X:\n"
260 " (Compiler, Disassembler, Template Generator)\n\n",
263 /* All ACPI tables with the common table header */
265 printf ("\n Supported ACPI tables:\n");
266 for (TableData = Gbl_AcpiSupportedTables, i = 1;
267 TableData->Signature; TableData++, i++)
269 printf ("%8u) %s %s\n", i,
270 TableData->Signature, TableData->Description);
275 /*******************************************************************************
277 * FUNCTION: UtDisplayConstantOpcodes
283 * DESCRIPTION: Print AML opcodes that can be used in constant expressions.
285 ******************************************************************************/
288 UtDisplayConstantOpcodes (
294 printf ("Constant expression opcode information\n\n");
296 for (i = 0; i < sizeof (AcpiGbl_AmlOpInfo) / sizeof (ACPI_OPCODE_INFO); i++)
298 if (AcpiGbl_AmlOpInfo[i].Flags & AML_CONSTANT)
300 printf ("%s\n", AcpiGbl_AmlOpInfo[i].Name);
306 /*******************************************************************************
308 * FUNCTION: UtLocalCalloc
310 * PARAMETERS: Size - Bytes to be allocated
312 * RETURN: Pointer to the allocated memory. Guaranteed to be valid.
314 * DESCRIPTION: Allocate zero-initialized memory. Aborts the compile on an
315 * allocation failure, on the assumption that nothing more can be
318 ******************************************************************************/
327 Allocated = ACPI_ALLOCATE_ZEROED (Size);
330 AslCommonError (ASL_ERROR, ASL_MSG_MEMORY_ALLOCATION,
331 Gbl_CurrentLineNumber, Gbl_LogicalLineNumber,
332 Gbl_InputByteCount, Gbl_CurrentColumn,
333 Gbl_Files[ASL_FILE_INPUT].Filename, NULL);
340 TotalAllocated += Size;
345 /*******************************************************************************
347 * FUNCTION: UtBeginEvent
349 * PARAMETERS: Name - Ascii name of this event
351 * RETURN: Event number (integer index)
353 * DESCRIPTION: Saves the current time with this event
355 ******************************************************************************/
362 if (AslGbl_NextEvent >= ASL_NUM_EVENTS)
364 AcpiOsPrintf ("Ran out of compiler event structs!\n");
365 return (AslGbl_NextEvent);
368 /* Init event with current (start) time */
370 AslGbl_Events[AslGbl_NextEvent].StartTime = AcpiOsGetTimer ();
371 AslGbl_Events[AslGbl_NextEvent].EventName = Name;
372 AslGbl_Events[AslGbl_NextEvent].Valid = TRUE;
373 return (AslGbl_NextEvent++);
377 /*******************************************************************************
379 * FUNCTION: UtEndEvent
381 * PARAMETERS: Event - Event number (integer index)
385 * DESCRIPTION: Saves the current time (end time) with this event
387 ******************************************************************************/
394 if (Event >= ASL_NUM_EVENTS)
399 /* Insert end time for event */
401 AslGbl_Events[Event].EndTime = AcpiOsGetTimer ();
405 /*******************************************************************************
409 * PARAMETERS: Type - Type of output
410 * Fmt - Printf format string
411 * ... - variable printf list
415 * DESCRIPTION: Conditional print statement. Prints to stderr only if the
418 ******************************************************************************/
434 if ((Type == ASL_PARSE_OUTPUT) &&
435 (!(AslCompilerdebug)))
440 va_start (Args, Fmt);
441 (void) vfprintf (stderr, Fmt, Args);
447 /*******************************************************************************
449 * FUNCTION: UtSetParseOpName
451 * PARAMETERS: Op - Parse op to be named.
455 * DESCRIPTION: Insert the ascii name of the parse opcode
457 ******************************************************************************/
461 ACPI_PARSE_OBJECT *Op)
464 strncpy (Op->Asl.ParseOpName, UtGetOpName (Op->Asl.ParseOpcode),
465 ACPI_MAX_PARSEOP_NAME);
469 /*******************************************************************************
471 * FUNCTION: UtDisplaySummary
473 * PARAMETERS: FileID - ID of outpout file
477 * DESCRIPTION: Display compilation statistics
479 ******************************************************************************/
488 if (FileId != ASL_FILE_STDOUT)
490 /* Compiler name and version number */
492 FlPrintFile (FileId, "%s version %X\n\n",
493 ASL_COMPILER_NAME, (UINT32) ACPI_CA_VERSION);
496 /* Summary of main input and output files */
498 if (Gbl_FileType == ASL_INPUT_TYPE_ASCII_DATA)
501 "%-14s %s - %u lines, %u bytes, %u fields\n",
503 Gbl_Files[ASL_FILE_INPUT].Filename, Gbl_CurrentLineNumber,
504 Gbl_InputByteCount, Gbl_InputFieldCount);
506 if ((Gbl_ExceptionCount[ASL_ERROR] == 0) || (Gbl_IgnoreErrors))
509 "%-14s %s - %u bytes\n",
511 Gbl_Files[ASL_FILE_AML_OUTPUT].Filename, Gbl_TableLength);
517 "%-14s %s - %u lines, %u bytes, %u keywords\n",
519 Gbl_Files[ASL_FILE_INPUT].Filename, Gbl_CurrentLineNumber,
520 Gbl_OriginalInputFileSize, TotalKeywords);
524 if ((Gbl_ExceptionCount[ASL_ERROR] == 0) || (Gbl_IgnoreErrors))
526 if (Gbl_Files[ASL_FILE_AML_OUTPUT].Handle)
529 "%-14s %s - %u bytes, %u named objects, "
530 "%u executable opcodes\n",
532 Gbl_Files[ASL_FILE_AML_OUTPUT].Filename,
533 FlGetFileSize (ASL_FILE_AML_OUTPUT),
534 TotalNamedObjects, TotalExecutableOpcodes);
539 /* Display summary of any optional files */
541 for (i = ASL_FILE_SOURCE_OUTPUT; i <= ASL_MAX_FILE_TYPE; i++)
543 if (!Gbl_Files[i].Filename || !Gbl_Files[i].Handle)
548 /* .SRC is a temp file unless specifically requested */
550 if ((i == ASL_FILE_SOURCE_OUTPUT) && (!Gbl_SourceOutputFlag))
555 /* .PRE is the preprocessor intermediate file */
557 if ((i == ASL_FILE_PREPROCESSOR) && (!Gbl_KeepPreprocessorTempFile))
562 FlPrintFile (FileId, "%14s %s - %u bytes\n",
563 Gbl_Files[i].ShortDescription,
564 Gbl_Files[i].Filename, FlGetFileSize (i));
570 "\nCompilation complete. %u Errors, %u Warnings, %u Remarks",
571 Gbl_ExceptionCount[ASL_ERROR],
572 Gbl_ExceptionCount[ASL_WARNING] +
573 Gbl_ExceptionCount[ASL_WARNING2] +
574 Gbl_ExceptionCount[ASL_WARNING3],
575 Gbl_ExceptionCount[ASL_REMARK]);
577 if (Gbl_FileType != ASL_INPUT_TYPE_ASCII_DATA)
579 FlPrintFile (FileId, ", %u Optimizations",
580 Gbl_ExceptionCount[ASL_OPTIMIZATION]);
584 FlPrintFile (FileId, ", %u Constants Folded", TotalFolds);
588 FlPrintFile (FileId, "\n");
592 /*******************************************************************************
594 * FUNCTION: UtCheckIntegerRange
596 * PARAMETERS: Op - Integer parse node
597 * LowValue - Smallest allowed value
598 * HighValue - Largest allowed value
600 * RETURN: Op if OK, otherwise NULL
602 * DESCRIPTION: Check integer for an allowable range
604 ******************************************************************************/
607 UtCheckIntegerRange (
608 ACPI_PARSE_OBJECT *Op,
618 if ((Op->Asl.Value.Integer < LowValue) ||
619 (Op->Asl.Value.Integer > HighValue))
621 sprintf (MsgBuffer, "0x%X, allowable: 0x%X-0x%X",
622 (UINT32) Op->Asl.Value.Integer, LowValue, HighValue);
624 AslError (ASL_ERROR, ASL_MSG_RANGE, Op, MsgBuffer);
632 /*******************************************************************************
634 * FUNCTION: UtStringCacheCalloc
636 * PARAMETERS: Length - Size of buffer requested
638 * RETURN: Pointer to the buffer. Aborts compiler on allocation failure
640 * DESCRIPTION: Allocate a string buffer. Bypass the local
641 * dynamic memory manager for performance reasons (This has a
642 * major impact on the speed of the compiler.)
644 ******************************************************************************/
647 UtStringCacheCalloc (
651 ASL_CACHE_INFO *Cache;
652 UINT32 CacheSize = ASL_STRING_CACHE_SIZE;
655 if (Length > CacheSize)
659 if (Gbl_StringCacheList)
661 Cache = UtLocalCalloc (sizeof (Cache->Next) + CacheSize);
663 /* Link new cache buffer just following head of list */
665 Cache->Next = Gbl_StringCacheList->Next;
666 Gbl_StringCacheList->Next = Cache;
668 /* Leave cache management pointers alone as they pertain to head */
671 Gbl_StringSize += Length;
673 return (Cache->Buffer);
677 if ((Gbl_StringCacheNext + Length) >= Gbl_StringCacheLast)
679 /* Allocate a new buffer */
681 Cache = UtLocalCalloc (sizeof (Cache->Next) + CacheSize);
683 /* Link new cache buffer to head of list */
685 Cache->Next = Gbl_StringCacheList;
686 Gbl_StringCacheList = Cache;
688 /* Setup cache management pointers */
690 Gbl_StringCacheNext = Cache->Buffer;
691 Gbl_StringCacheLast = Gbl_StringCacheNext + CacheSize;
695 Gbl_StringSize += Length;
697 Buffer = Gbl_StringCacheNext;
698 Gbl_StringCacheNext += Length;
703 /******************************************************************************
705 * FUNCTION: UtExpandLineBuffers
707 * PARAMETERS: None. Updates global line buffer pointers.
709 * RETURN: None. Reallocates the global line buffers
711 * DESCRIPTION: Called if the current line buffer becomes filled. Reallocates
712 * all global line buffers and updates Gbl_LineBufferSize. NOTE:
713 * Also used for the initial allocation of the buffers, when
714 * all of the buffer pointers are NULL. Initial allocations are
715 * of size ASL_DEFAULT_LINE_BUFFER_SIZE
717 *****************************************************************************/
720 UtExpandLineBuffers (
726 /* Attempt to double the size of all line buffers */
728 NewSize = Gbl_LineBufferSize * 2;
729 if (Gbl_CurrentLineBuffer)
731 DbgPrint (ASL_DEBUG_OUTPUT,
732 "Increasing line buffer size from %u to %u\n",
733 Gbl_LineBufferSize, NewSize);
736 Gbl_CurrentLineBuffer = realloc (Gbl_CurrentLineBuffer, NewSize);
737 Gbl_LineBufPtr = Gbl_CurrentLineBuffer;
738 if (!Gbl_CurrentLineBuffer)
743 Gbl_MainTokenBuffer = realloc (Gbl_MainTokenBuffer, NewSize);
744 if (!Gbl_MainTokenBuffer)
749 Gbl_MacroTokenBuffer = realloc (Gbl_MacroTokenBuffer, NewSize);
750 if (!Gbl_MacroTokenBuffer)
755 Gbl_ExpressionTokenBuffer = realloc (Gbl_ExpressionTokenBuffer, NewSize);
756 if (!Gbl_ExpressionTokenBuffer)
761 Gbl_LineBufferSize = NewSize;
765 /* On error above, simply issue error messages and abort, cannot continue */
768 printf ("Could not increase line buffer size from %u to %u\n",
769 Gbl_LineBufferSize, Gbl_LineBufferSize * 2);
771 AslError (ASL_ERROR, ASL_MSG_BUFFER_ALLOCATION,
777 /******************************************************************************
779 * FUNCTION: UtFreeLineBuffers
785 * DESCRIPTION: Free all line buffers
787 *****************************************************************************/
794 free (Gbl_CurrentLineBuffer);
795 free (Gbl_MainTokenBuffer);
796 free (Gbl_MacroTokenBuffer);
797 free (Gbl_ExpressionTokenBuffer);
801 /*******************************************************************************
803 * FUNCTION: UtInternalizeName
805 * PARAMETERS: ExternalName - Name to convert
806 * ConvertedName - Where the converted name is returned
810 * DESCRIPTION: Convert an external (ASL) name to an internal (AML) name
812 ******************************************************************************/
817 char **ConvertedName)
819 ACPI_NAMESTRING_INFO Info;
828 /* Get the length of the new internal name */
830 Info.ExternalName = ExternalName;
831 AcpiNsGetInternalNameLength (&Info);
833 /* We need a segment to store the internal name */
835 Info.InternalName = UtStringCacheCalloc (Info.Length);
839 Status = AcpiNsBuildInternalName (&Info);
840 if (ACPI_FAILURE (Status))
845 *ConvertedName = Info.InternalName;
850 /*******************************************************************************
852 * FUNCTION: UtPadNameWithUnderscores
854 * PARAMETERS: NameSeg - Input nameseg
855 * PaddedNameSeg - Output padded nameseg
857 * RETURN: Padded nameseg.
859 * DESCRIPTION: Pads a NameSeg with underscores if necessary to form a full
862 ******************************************************************************/
865 UtPadNameWithUnderscores (
872 for (i = 0; (i < ACPI_NAME_SIZE); i++)
876 *PaddedNameSeg = *NameSeg;
881 *PaddedNameSeg = '_';
889 /*******************************************************************************
891 * FUNCTION: UtAttachNameseg
893 * PARAMETERS: Op - Parent parse node
894 * Name - Full ExternalName
896 * RETURN: None; Sets the NameSeg field in parent node
898 * DESCRIPTION: Extract the last nameseg of the ExternalName and store it
899 * in the NameSeg field of the Op.
901 ******************************************************************************/
905 ACPI_PARSE_OBJECT *Op,
909 char PaddedNameSeg[4];
917 /* Look for the last dot in the namepath */
919 NameSeg = strrchr (Name, '.');
922 /* Found last dot, we have also found the final nameseg */
925 UtPadNameWithUnderscores (NameSeg, PaddedNameSeg);
929 /* No dots in the namepath, there is only a single nameseg. */
930 /* Handle prefixes */
932 while (ACPI_IS_ROOT_PREFIX (*Name) ||
933 ACPI_IS_PARENT_PREFIX (*Name))
938 /* Remaining string should be one single nameseg */
940 UtPadNameWithUnderscores (Name, PaddedNameSeg);
943 ACPI_MOVE_NAME (Op->Asl.NameSeg, PaddedNameSeg);
947 /*******************************************************************************
949 * FUNCTION: UtAttachNamepathToOwner
951 * PARAMETERS: Op - Parent parse node
952 * NameOp - Node that contains the name
954 * RETURN: Sets the ExternalName and Namepath in the parent node
956 * DESCRIPTION: Store the name in two forms in the parent node: The original
957 * (external) name, and the internalized name that is used within
958 * the ACPI namespace manager.
960 ******************************************************************************/
963 UtAttachNamepathToOwner (
964 ACPI_PARSE_OBJECT *Op,
965 ACPI_PARSE_OBJECT *NameOp)
970 /* Full external path */
972 Op->Asl.ExternalName = NameOp->Asl.Value.String;
974 /* Save the NameOp for possible error reporting later */
976 Op->Asl.ParentMethod = (void *) NameOp;
978 /* Last nameseg of the path */
980 UtAttachNameseg (Op, Op->Asl.ExternalName);
982 /* Create internalized path */
984 Status = UtInternalizeName (NameOp->Asl.Value.String, &Op->Asl.Namepath);
985 if (ACPI_FAILURE (Status))
987 /* TBD: abort on no memory */
992 /*******************************************************************************
994 * FUNCTION: UtDoConstant
996 * PARAMETERS: String - Hexadecimal or decimal string
998 * RETURN: Converted Integer
1000 * DESCRIPTION: Convert a string to an integer, with error checking.
1002 ******************************************************************************/
1013 Status = AcpiUtStrtoul64 (String, ACPI_STRTOUL_64BIT, &Converted);
1014 if (ACPI_FAILURE (Status))
1016 sprintf (ErrBuf, "%s %s\n", "Conversion error:",
1017 AcpiFormatException (Status));
1018 AslCompilererror (ErrBuf);