159db4265SNate Lawson /****************************************************************************** 259db4265SNate Lawson * 359db4265SNate Lawson * Module Name: adisasm - Application-level disassembler routines 459db4265SNate Lawson * 559db4265SNate Lawson *****************************************************************************/ 659db4265SNate Lawson 70d84335fSJung-uk Kim /****************************************************************************** 80d84335fSJung-uk Kim * 90d84335fSJung-uk Kim * 1. Copyright Notice 100d84335fSJung-uk Kim * 1132ac4016SJung-uk Kim * Some or all of this work - Copyright (c) 1999 - 2018, Intel Corp. 1259db4265SNate Lawson * All rights reserved. 1359db4265SNate Lawson * 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 * 119d244b227SJung-uk Kim * Redistribution and use in source and binary forms, with or without 120d244b227SJung-uk Kim * modification, are permitted provided that the following conditions 121d244b227SJung-uk Kim * are met: 122d244b227SJung-uk Kim * 1. Redistributions of source code must retain the above copyright 123d244b227SJung-uk Kim * notice, this list of conditions, and the following disclaimer, 124d244b227SJung-uk Kim * without modification. 125d244b227SJung-uk Kim * 2. Redistributions in binary form must reproduce at minimum a disclaimer 126d244b227SJung-uk Kim * substantially similar to the "NO WARRANTY" disclaimer below 127d244b227SJung-uk Kim * ("Disclaimer") and any redistribution must be conditioned upon 128d244b227SJung-uk Kim * including a substantially similar Disclaimer requirement for further 129d244b227SJung-uk Kim * binary redistribution. 130d244b227SJung-uk Kim * 3. Neither the names of the above-listed copyright holders nor the names 131d244b227SJung-uk Kim * of any contributors may be used to endorse or promote products derived 132d244b227SJung-uk Kim * from this software without specific prior written permission. 13359db4265SNate Lawson * 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 147d244b227SJung-uk Kim * GNU General Public License ("GPL") version 2 as published by the Free 148d244b227SJung-uk Kim * Software Foundation. 14959db4265SNate Lawson * 1500d84335fSJung-uk Kim *****************************************************************************/ 15159db4265SNate Lawson 152313a0c13SJung-uk Kim #include <contrib/dev/acpica/compiler/aslcompiler.h> 153ab6f3bf9SJung-uk Kim #include <contrib/dev/acpica/include/amlcode.h> 154ab6f3bf9SJung-uk Kim #include <contrib/dev/acpica/include/acdisasm.h> 155ab6f3bf9SJung-uk Kim #include <contrib/dev/acpica/include/acdispat.h> 156ab6f3bf9SJung-uk Kim #include <contrib/dev/acpica/include/acnamesp.h> 157f8146b88SJung-uk Kim #include <contrib/dev/acpica/include/acparser.h> 158ab6f3bf9SJung-uk Kim #include <contrib/dev/acpica/include/acapps.h> 15959db4265SNate Lawson 16059db4265SNate Lawson 16159db4265SNate Lawson #define _COMPONENT ACPI_TOOLS 16259db4265SNate Lawson ACPI_MODULE_NAME ("adisasm") 16359db4265SNate Lawson 1641a39cfb0SJung-uk Kim /* Local prototypes */ 1651a39cfb0SJung-uk Kim 166f8146b88SJung-uk Kim static ACPI_STATUS 167f8146b88SJung-uk Kim AdDoExternalFileList ( 168f8146b88SJung-uk Kim char *Filename); 1691a39cfb0SJung-uk Kim 1707cf3e94aSJung-uk Kim static ACPI_STATUS 171f8146b88SJung-uk Kim AdDisassembleOneTable ( 1727cf3e94aSJung-uk Kim ACPI_TABLE_HEADER *Table, 173f8146b88SJung-uk Kim FILE *File, 174f8146b88SJung-uk Kim char *Filename, 175f8146b88SJung-uk Kim char *DisasmFilename); 1767cf3e94aSJung-uk Kim 177f8146b88SJung-uk Kim static ACPI_STATUS 178f8146b88SJung-uk Kim AdReparseOneTable ( 179f8146b88SJung-uk Kim ACPI_TABLE_HEADER *Table, 180f8146b88SJung-uk Kim FILE *File, 181f8146b88SJung-uk Kim ACPI_OWNER_ID OwnerId); 182f8146b88SJung-uk Kim 183f8146b88SJung-uk Kim 184f8146b88SJung-uk Kim ACPI_TABLE_DESC LocalTables[1]; 185f8146b88SJung-uk Kim ACPI_PARSE_OBJECT *AcpiGbl_ParseOpRoot; 186f8146b88SJung-uk Kim 187f8146b88SJung-uk Kim 188f8146b88SJung-uk Kim /* Stubs for everything except ASL compiler */ 18959db4265SNate Lawson 190fba7fc7eSJung-uk Kim #ifndef ACPI_ASL_COMPILER 19159db4265SNate Lawson BOOLEAN 19259db4265SNate Lawson AcpiDsIsResultUsed ( 19359db4265SNate Lawson ACPI_PARSE_OBJECT *Op, 19459db4265SNate Lawson ACPI_WALK_STATE *WalkState) 19559db4265SNate Lawson { 196f8146b88SJung-uk Kim return (TRUE); 19759db4265SNate Lawson } 1981a39cfb0SJung-uk Kim 1991a39cfb0SJung-uk Kim ACPI_STATUS 2001a39cfb0SJung-uk Kim AcpiDsMethodError ( 2011a39cfb0SJung-uk Kim ACPI_STATUS Status, 2021a39cfb0SJung-uk Kim ACPI_WALK_STATE *WalkState) 2031a39cfb0SJung-uk Kim { 2041a39cfb0SJung-uk Kim return (Status); 2051a39cfb0SJung-uk Kim } 20659db4265SNate Lawson #endif 20759db4265SNate Lawson 2084c52cad2SJung-uk Kim 2094c52cad2SJung-uk Kim /******************************************************************************* 2104c52cad2SJung-uk Kim * 21159db4265SNate Lawson * FUNCTION: AdInitialize 21259db4265SNate Lawson * 213f556842eSJung-uk Kim * PARAMETERS: None 21459db4265SNate Lawson * 21559db4265SNate Lawson * RETURN: Status 21659db4265SNate Lawson * 217f556842eSJung-uk Kim * DESCRIPTION: ACPICA and local initialization 21859db4265SNate Lawson * 21959db4265SNate Lawson ******************************************************************************/ 22059db4265SNate Lawson 22159db4265SNate Lawson ACPI_STATUS 22259db4265SNate Lawson AdInitialize ( 22359db4265SNate Lawson void) 22459db4265SNate Lawson { 22559db4265SNate Lawson ACPI_STATUS Status; 22659db4265SNate Lawson 22759db4265SNate Lawson 22859db4265SNate Lawson /* ACPICA subsystem initialization */ 22959db4265SNate Lawson 2301a39cfb0SJung-uk Kim Status = AcpiOsInitialize (); 231a9f12690SJung-uk Kim if (ACPI_FAILURE (Status)) 232a9f12690SJung-uk Kim { 2330d84335fSJung-uk Kim fprintf (stderr, "Could not initialize ACPICA subsystem: %s\n", 2340d84335fSJung-uk Kim AcpiFormatException (Status)); 2350d84335fSJung-uk Kim 236a9f12690SJung-uk Kim return (Status); 237a9f12690SJung-uk Kim } 238a9f12690SJung-uk Kim 239a9f12690SJung-uk Kim Status = AcpiUtInitGlobals (); 240a9f12690SJung-uk Kim if (ACPI_FAILURE (Status)) 241a9f12690SJung-uk Kim { 2420d84335fSJung-uk Kim fprintf (stderr, "Could not initialize ACPICA globals: %s\n", 2430d84335fSJung-uk Kim AcpiFormatException (Status)); 2440d84335fSJung-uk Kim 245a9f12690SJung-uk Kim return (Status); 246a9f12690SJung-uk Kim } 2471a39cfb0SJung-uk Kim 24859db4265SNate Lawson Status = AcpiUtMutexInitialize (); 24959db4265SNate Lawson if (ACPI_FAILURE (Status)) 25059db4265SNate Lawson { 2510d84335fSJung-uk Kim fprintf (stderr, "Could not initialize ACPICA mutex objects: %s\n", 2520d84335fSJung-uk Kim AcpiFormatException (Status)); 2530d84335fSJung-uk Kim 254a9f12690SJung-uk Kim return (Status); 25559db4265SNate Lawson } 25659db4265SNate Lawson 25759db4265SNate Lawson Status = AcpiNsRootInitialize (); 2581a39cfb0SJung-uk Kim if (ACPI_FAILURE (Status)) 2591a39cfb0SJung-uk Kim { 2600d84335fSJung-uk Kim fprintf (stderr, "Could not initialize ACPICA namespace: %s\n", 2610d84335fSJung-uk Kim AcpiFormatException (Status)); 2620d84335fSJung-uk Kim 263a9f12690SJung-uk Kim return (Status); 2641a39cfb0SJung-uk Kim } 2651a39cfb0SJung-uk Kim 2661a39cfb0SJung-uk Kim /* Setup the Table Manager (cheat - there is no RSDT) */ 2671a39cfb0SJung-uk Kim 2683f5e024cSJung-uk Kim AcpiGbl_RootTableList.MaxTableCount = 1; 2693f5e024cSJung-uk Kim AcpiGbl_RootTableList.CurrentTableCount = 0; 2701a39cfb0SJung-uk Kim AcpiGbl_RootTableList.Tables = LocalTables; 2711a39cfb0SJung-uk Kim 2720d84335fSJung-uk Kim return (AE_OK); 27359db4265SNate Lawson } 27459db4265SNate Lawson 27559db4265SNate Lawson 27659db4265SNate Lawson /****************************************************************************** 27759db4265SNate Lawson * 27859db4265SNate Lawson * FUNCTION: AdAmlDisassemble 27959db4265SNate Lawson * 280fba7fc7eSJung-uk Kim * PARAMETERS: Filename - AML input filename 281fba7fc7eSJung-uk Kim * OutToFile - TRUE if output should go to a file 282fba7fc7eSJung-uk Kim * Prefix - Path prefix for output 283fba7fc7eSJung-uk Kim * OutFilename - where the filename is returned 28459db4265SNate Lawson * 28559db4265SNate Lawson * RETURN: Status 28659db4265SNate Lawson * 287f8146b88SJung-uk Kim * DESCRIPTION: Disassembler entry point. Disassemble an entire ACPI table. 28859db4265SNate Lawson * 28959db4265SNate Lawson *****************************************************************************/ 29059db4265SNate Lawson 29159db4265SNate Lawson ACPI_STATUS 29259db4265SNate Lawson AdAmlDisassemble ( 29359db4265SNate Lawson BOOLEAN OutToFile, 29459db4265SNate Lawson char *Filename, 29559db4265SNate Lawson char *Prefix, 296313a0c13SJung-uk Kim char **OutFilename) 29759db4265SNate Lawson { 29859db4265SNate Lawson ACPI_STATUS Status; 29959db4265SNate Lawson char *DisasmFilename = NULL; 30059db4265SNate Lawson FILE *File = NULL; 301a9f12690SJung-uk Kim ACPI_TABLE_HEADER *Table = NULL; 302f8146b88SJung-uk Kim ACPI_NEW_TABLE_DESC *ListHead = NULL; 30359db4265SNate Lawson 30459db4265SNate Lawson 30559db4265SNate Lawson /* 306f556842eSJung-uk Kim * Input: AML code from either a file or via GetTables (memory or 307f556842eSJung-uk Kim * registry) 30859db4265SNate Lawson */ 30959db4265SNate Lawson if (Filename) 31059db4265SNate Lawson { 311f8146b88SJung-uk Kim /* Get the list of all AML tables in the file */ 312f8146b88SJung-uk Kim 313f8146b88SJung-uk Kim Status = AcGetAllTablesFromFile (Filename, 314f8146b88SJung-uk Kim ACPI_GET_ALL_TABLES, &ListHead); 315f8146b88SJung-uk Kim if (ACPI_FAILURE (Status)) 316f8146b88SJung-uk Kim { 317f8146b88SJung-uk Kim AcpiOsPrintf ("Could not get ACPI tables from %s, %s\n", 318f8146b88SJung-uk Kim Filename, AcpiFormatException (Status)); 319f8146b88SJung-uk Kim return (Status); 320f8146b88SJung-uk Kim } 321f8146b88SJung-uk Kim 322f8146b88SJung-uk Kim /* Process any user-specified files for external objects */ 323f8146b88SJung-uk Kim 324f8146b88SJung-uk Kim Status = AdDoExternalFileList (Filename); 32559db4265SNate Lawson if (ACPI_FAILURE (Status)) 32659db4265SNate Lawson { 3278ef1a331SJung-uk Kim return (Status); 32859db4265SNate Lawson } 32959db4265SNate Lawson } 33059db4265SNate Lawson else 33159db4265SNate Lawson { 332313a0c13SJung-uk Kim Status = AdGetLocalTables (); 33359db4265SNate Lawson if (ACPI_FAILURE (Status)) 33459db4265SNate Lawson { 33559db4265SNate Lawson AcpiOsPrintf ("Could not get ACPI tables, %s\n", 33659db4265SNate Lawson AcpiFormatException (Status)); 3378ef1a331SJung-uk Kim return (Status); 33859db4265SNate Lawson } 33959db4265SNate Lawson 34070e6ab8fSJung-uk Kim if (!AcpiGbl_DmOpt_Disasm) 34159db4265SNate Lawson { 3428ef1a331SJung-uk Kim return (AE_OK); 34359db4265SNate Lawson } 34459db4265SNate Lawson 3451a39cfb0SJung-uk Kim /* Obtained the local tables, just disassemble the DSDT */ 34659db4265SNate Lawson 3471a39cfb0SJung-uk Kim Status = AcpiGetTable (ACPI_SIG_DSDT, 0, &Table); 3481a39cfb0SJung-uk Kim if (ACPI_FAILURE (Status)) 3491a39cfb0SJung-uk Kim { 3501a39cfb0SJung-uk Kim AcpiOsPrintf ("Could not get DSDT, %s\n", 3511a39cfb0SJung-uk Kim AcpiFormatException (Status)); 3528ef1a331SJung-uk Kim return (Status); 3531a39cfb0SJung-uk Kim } 3541a39cfb0SJung-uk Kim 35559db4265SNate Lawson AcpiOsPrintf ("\nDisassembly of DSDT\n"); 3561a39cfb0SJung-uk Kim Prefix = AdGenerateFilename ("dsdt", Table->OemTableId); 35759db4265SNate Lawson } 35859db4265SNate Lawson 35959db4265SNate Lawson /* 360f556842eSJung-uk Kim * Output: ASL code. Redirect to a file if requested 36159db4265SNate Lawson */ 36259db4265SNate Lawson if (OutToFile) 36359db4265SNate Lawson { 36459db4265SNate Lawson /* Create/Open a disassembly output file */ 36559db4265SNate Lawson 36659db4265SNate Lawson DisasmFilename = FlGenerateFilename (Prefix, FILE_SUFFIX_DISASSEMBLY); 367313a0c13SJung-uk Kim if (!DisasmFilename) 36859db4265SNate Lawson { 36959db4265SNate Lawson fprintf (stderr, "Could not generate output filename\n"); 370e50beb51SNate Lawson Status = AE_ERROR; 371e50beb51SNate Lawson goto Cleanup; 37259db4265SNate Lawson } 37359db4265SNate Lawson 37459db4265SNate Lawson File = fopen (DisasmFilename, "w+"); 37559db4265SNate Lawson if (!File) 37659db4265SNate Lawson { 377f8146b88SJung-uk Kim fprintf (stderr, "Could not open output file %s\n", 378f8146b88SJung-uk Kim DisasmFilename); 379e50beb51SNate Lawson Status = AE_ERROR; 380e50beb51SNate Lawson goto Cleanup; 38159db4265SNate Lawson } 38259db4265SNate Lawson 38359db4265SNate Lawson AcpiOsRedirectOutput (File); 38459db4265SNate Lawson } 38559db4265SNate Lawson 38659db4265SNate Lawson *OutFilename = DisasmFilename; 38759db4265SNate Lawson 388f8146b88SJung-uk Kim /* Disassemble all AML tables within the file */ 389f8146b88SJung-uk Kim 390f8146b88SJung-uk Kim while (ListHead) 391f8146b88SJung-uk Kim { 392f8146b88SJung-uk Kim Status = AdDisassembleOneTable (ListHead->Table, 393f8146b88SJung-uk Kim File, Filename, DisasmFilename); 394f8146b88SJung-uk Kim if (ACPI_FAILURE (Status)) 395f8146b88SJung-uk Kim { 396f8146b88SJung-uk Kim break; 397f8146b88SJung-uk Kim } 398f8146b88SJung-uk Kim 399f8146b88SJung-uk Kim ListHead = ListHead->Next; 400f8146b88SJung-uk Kim } 401f8146b88SJung-uk Kim 402f8146b88SJung-uk Kim Cleanup: 403f8146b88SJung-uk Kim 404f8146b88SJung-uk Kim if (Table && 405f8146b88SJung-uk Kim !AcpiGbl_ForceAmlDisassembly && 406f8146b88SJung-uk Kim !AcpiUtIsAmlTable (Table)) 407f8146b88SJung-uk Kim { 408f8146b88SJung-uk Kim ACPI_FREE (Table); 409f8146b88SJung-uk Kim } 410f8146b88SJung-uk Kim 4115f9b24faSJung-uk Kim AcDeleteTableList (ListHead); 4125f9b24faSJung-uk Kim 413f8146b88SJung-uk Kim if (File) 414f8146b88SJung-uk Kim { 415f8146b88SJung-uk Kim fclose (File); 416f8146b88SJung-uk Kim AcpiOsRedirectOutput (stdout); 417f8146b88SJung-uk Kim } 418f8146b88SJung-uk Kim 419f8146b88SJung-uk Kim AcpiPsDeleteParseTree (AcpiGbl_ParseOpRoot); 420f8146b88SJung-uk Kim AcpiGbl_ParseOpRoot = NULL; 421f8146b88SJung-uk Kim return (Status); 422f8146b88SJung-uk Kim } 423f8146b88SJung-uk Kim 424f8146b88SJung-uk Kim 425f8146b88SJung-uk Kim /****************************************************************************** 426f8146b88SJung-uk Kim * 427f8146b88SJung-uk Kim * FUNCTION: AdDisassembleOneTable 428f8146b88SJung-uk Kim * 429f8146b88SJung-uk Kim * PARAMETERS: Table - Raw AML table 430f8146b88SJung-uk Kim * File - Pointer for the input file 431f8146b88SJung-uk Kim * Filename - AML input filename 432f8146b88SJung-uk Kim * DisasmFilename - Output filename 433f8146b88SJung-uk Kim * 434f8146b88SJung-uk Kim * RETURN: Status 435f8146b88SJung-uk Kim * 436f8146b88SJung-uk Kim * DESCRIPTION: Disassemble a single ACPI table. AML or data table. 437f8146b88SJung-uk Kim * 438f8146b88SJung-uk Kim *****************************************************************************/ 439f8146b88SJung-uk Kim 440f8146b88SJung-uk Kim static ACPI_STATUS 441f8146b88SJung-uk Kim AdDisassembleOneTable ( 442f8146b88SJung-uk Kim ACPI_TABLE_HEADER *Table, 443f8146b88SJung-uk Kim FILE *File, 444f8146b88SJung-uk Kim char *Filename, 445f8146b88SJung-uk Kim char *DisasmFilename) 446f8146b88SJung-uk Kim { 447f8146b88SJung-uk Kim ACPI_STATUS Status; 448f8146b88SJung-uk Kim ACPI_OWNER_ID OwnerId; 449f8146b88SJung-uk Kim 450f8146b88SJung-uk Kim 4510d84335fSJung-uk Kim #ifdef ACPI_ASL_COMPILER 4520d84335fSJung-uk Kim 4530d84335fSJung-uk Kim /* 4540d84335fSJung-uk Kim * For ASL-/ASL+ converter: replace the temporary "XXXX" 4550d84335fSJung-uk Kim * table signature with the original. This "XXXX" makes 4560d84335fSJung-uk Kim * it harder for the AML interpreter to run the badaml 4570d84335fSJung-uk Kim * (.xxx) file produced from the converter in case if 4580d84335fSJung-uk Kim * it fails to get deleted. 4590d84335fSJung-uk Kim */ 460f1db5ef7SJung-uk Kim if (AcpiGbl_CaptureComments) 4610d84335fSJung-uk Kim { 462f1db5ef7SJung-uk Kim strncpy (Table->Signature, AcpiGbl_TableSig, ACPI_NAME_SIZE); 4630d84335fSJung-uk Kim } 4640d84335fSJung-uk Kim #endif 4650d84335fSJung-uk Kim 4667cf3e94aSJung-uk Kim /* ForceAmlDisassembly means to assume the table contains valid AML */ 4677cf3e94aSJung-uk Kim 4687cf3e94aSJung-uk Kim if (!AcpiGbl_ForceAmlDisassembly && !AcpiUtIsAmlTable (Table)) 4691a39cfb0SJung-uk Kim { 4707cf3e94aSJung-uk Kim AdDisassemblerHeader (Filename, ACPI_IS_DATA_TABLE); 471f8146b88SJung-uk Kim 472f8146b88SJung-uk Kim /* This is a "Data Table" (non-AML table) */ 473f8146b88SJung-uk Kim 4741a39cfb0SJung-uk Kim AcpiOsPrintf (" * ACPI Data Table [%4.4s]\n *\n", 4751a39cfb0SJung-uk Kim Table->Signature); 476ec3fc72fSJung-uk Kim AcpiOsPrintf (" * Format: [HexOffset DecimalOffset ByteLength] " 477ec3fc72fSJung-uk Kim "FieldName : FieldValue\n */\n\n"); 4781a39cfb0SJung-uk Kim 4791a39cfb0SJung-uk Kim AcpiDmDumpDataTable (Table); 4804c52cad2SJung-uk Kim fprintf (stderr, "Acpi Data Table [%4.4s] decoded\n", 4814c52cad2SJung-uk Kim Table->Signature); 4821c0e1b6dSJung-uk Kim 4831c0e1b6dSJung-uk Kim if (File) 4841c0e1b6dSJung-uk Kim { 4854c52cad2SJung-uk Kim fprintf (stderr, "Formatted output: %s - %u bytes\n", 486313a0c13SJung-uk Kim DisasmFilename, CmGetFileSize (File)); 4871a39cfb0SJung-uk Kim } 48859db4265SNate Lawson 489f8146b88SJung-uk Kim return (AE_OK); 490f8146b88SJung-uk Kim } 491f8146b88SJung-uk Kim 492f8146b88SJung-uk Kim /* 493f8146b88SJung-uk Kim * This is an AML table (DSDT or SSDT). 494f8146b88SJung-uk Kim * Always parse the tables, only option is what to display 495f8146b88SJung-uk Kim */ 496a9f12690SJung-uk Kim Status = AdParseTable (Table, &OwnerId, TRUE, FALSE); 49759db4265SNate Lawson if (ACPI_FAILURE (Status)) 49859db4265SNate Lawson { 49959db4265SNate Lawson AcpiOsPrintf ("Could not parse ACPI tables, %s\n", 50059db4265SNate Lawson AcpiFormatException (Status)); 501f8146b88SJung-uk Kim return (Status); 50259db4265SNate Lawson } 50359db4265SNate Lawson 504f8146b88SJung-uk Kim /* Debug output, namespace and parse tree */ 505f8146b88SJung-uk Kim 506f8146b88SJung-uk Kim if (AslCompilerdebug && File) 5071a39cfb0SJung-uk Kim { 5081a39cfb0SJung-uk Kim AcpiOsPrintf ("/**** Before second load\n"); 5091a39cfb0SJung-uk Kim 510efcc2a30SJung-uk Kim NsSetupNamespaceListing (File); 511efcc2a30SJung-uk Kim NsDisplayNamespace (); 512f8146b88SJung-uk Kim 5131a39cfb0SJung-uk Kim AcpiOsPrintf ("*****/\n"); 5141a39cfb0SJung-uk Kim } 5151a39cfb0SJung-uk Kim 516ec3fc72fSJung-uk Kim /* Load namespace from names created within control methods */ 517ec3fc72fSJung-uk Kim 518ec3fc72fSJung-uk Kim AcpiDmFinishNamespaceLoad (AcpiGbl_ParseOpRoot, 519ec3fc72fSJung-uk Kim AcpiGbl_RootNode, OwnerId); 5201a39cfb0SJung-uk Kim 5211a39cfb0SJung-uk Kim /* 522ec3fc72fSJung-uk Kim * Cross reference the namespace here, in order to 523ec3fc72fSJung-uk Kim * generate External() statements 5241a39cfb0SJung-uk Kim */ 525ec3fc72fSJung-uk Kim AcpiDmCrossReferenceNamespace (AcpiGbl_ParseOpRoot, 526ec3fc72fSJung-uk Kim AcpiGbl_RootNode, OwnerId); 5271a39cfb0SJung-uk Kim 5281a39cfb0SJung-uk Kim if (AslCompilerdebug) 5291a39cfb0SJung-uk Kim { 5301a39cfb0SJung-uk Kim AcpiDmDumpTree (AcpiGbl_ParseOpRoot); 5311a39cfb0SJung-uk Kim } 5321a39cfb0SJung-uk Kim 5331a39cfb0SJung-uk Kim /* Find possible calls to external control methods */ 5341a39cfb0SJung-uk Kim 5351a39cfb0SJung-uk Kim AcpiDmFindOrphanMethods (AcpiGbl_ParseOpRoot); 5361a39cfb0SJung-uk Kim 5371a39cfb0SJung-uk Kim /* 538ec3fc72fSJung-uk Kim * If we found any external control methods, we must reparse 539ec3fc72fSJung-uk Kim * the entire tree with the new information (namely, the 540ec3fc72fSJung-uk Kim * number of arguments per method) 5411a39cfb0SJung-uk Kim */ 542af051161SJung-uk Kim if (AcpiDmGetUnresolvedExternalMethodCount ()) 5431a39cfb0SJung-uk Kim { 544f8146b88SJung-uk Kim Status = AdReparseOneTable (Table, File, OwnerId); 5451a39cfb0SJung-uk Kim if (ACPI_FAILURE (Status)) 5461a39cfb0SJung-uk Kim { 547f8146b88SJung-uk Kim return (Status); 5481a39cfb0SJung-uk Kim } 5491a39cfb0SJung-uk Kim } 550e0ef747bSNate Lawson 551ec3fc72fSJung-uk Kim /* 552ec3fc72fSJung-uk Kim * Now that the namespace is finalized, we can perform namespace 553ec3fc72fSJung-uk Kim * transforms. 554ec3fc72fSJung-uk Kim * 555ec3fc72fSJung-uk Kim * 1) Convert fixed-offset references to resource descriptors 556ec3fc72fSJung-uk Kim * to symbolic references (Note: modifies namespace) 557ec3fc72fSJung-uk Kim */ 558af051161SJung-uk Kim AcpiDmConvertParseObjects (AcpiGbl_ParseOpRoot, AcpiGbl_RootNode); 559ec3fc72fSJung-uk Kim 56059db4265SNate Lawson /* Optional displays */ 56159db4265SNate Lawson 56270e6ab8fSJung-uk Kim if (AcpiGbl_DmOpt_Disasm) 56359db4265SNate Lawson { 5648ef1a331SJung-uk Kim /* This is the real disassembly */ 5658ef1a331SJung-uk Kim 56659db4265SNate Lawson AdDisplayTables (Filename, Table); 5678ef1a331SJung-uk Kim 5688ef1a331SJung-uk Kim /* Dump hex table if requested (-vt) */ 5698ef1a331SJung-uk Kim 5708ef1a331SJung-uk Kim AcpiDmDumpDataTable (Table); 5718ef1a331SJung-uk Kim 5724c52cad2SJung-uk Kim fprintf (stderr, "Disassembly completed\n"); 5731c0e1b6dSJung-uk Kim if (File) 5741c0e1b6dSJung-uk Kim { 5754c52cad2SJung-uk Kim fprintf (stderr, "ASL Output: %s - %u bytes\n", 576313a0c13SJung-uk Kim DisasmFilename, CmGetFileSize (File)); 5771c0e1b6dSJung-uk Kim } 578313a0c13SJung-uk Kim 579*6f1f1a63SJung-uk Kim if (AslGbl_MapfileFlag) 580313a0c13SJung-uk Kim { 581313a0c13SJung-uk Kim fprintf (stderr, "%14s %s - %u bytes\n", 582*6f1f1a63SJung-uk Kim AslGbl_Files[ASL_FILE_MAP_OUTPUT].ShortDescription, 583*6f1f1a63SJung-uk Kim AslGbl_Files[ASL_FILE_MAP_OUTPUT].Filename, 584313a0c13SJung-uk Kim FlGetFileSize (ASL_FILE_MAP_OUTPUT)); 585313a0c13SJung-uk Kim } 5861a39cfb0SJung-uk Kim } 587f8146b88SJung-uk Kim 588f8146b88SJung-uk Kim return (AE_OK); 58959db4265SNate Lawson } 59059db4265SNate Lawson 591a9f12690SJung-uk Kim 592f8146b88SJung-uk Kim /****************************************************************************** 593f8146b88SJung-uk Kim * 594f8146b88SJung-uk Kim * FUNCTION: AdReparseOneTable 595f8146b88SJung-uk Kim * 596f8146b88SJung-uk Kim * PARAMETERS: Table - Raw AML table 597f8146b88SJung-uk Kim * File - Pointer for the input file 598f8146b88SJung-uk Kim * OwnerId - ID for this table 599f8146b88SJung-uk Kim * 600f8146b88SJung-uk Kim * RETURN: Status 601f8146b88SJung-uk Kim * 602f8146b88SJung-uk Kim * DESCRIPTION: Reparse a table that has already been loaded. Used to 603f8146b88SJung-uk Kim * integrate information about external control methods. 604f8146b88SJung-uk Kim * These methods may have been previously parsed incorrectly. 605f8146b88SJung-uk Kim * 606f8146b88SJung-uk Kim *****************************************************************************/ 607f8146b88SJung-uk Kim 608f8146b88SJung-uk Kim static ACPI_STATUS 609f8146b88SJung-uk Kim AdReparseOneTable ( 610f8146b88SJung-uk Kim ACPI_TABLE_HEADER *Table, 611f8146b88SJung-uk Kim FILE *File, 612f8146b88SJung-uk Kim ACPI_OWNER_ID OwnerId) 613a9f12690SJung-uk Kim { 614f8146b88SJung-uk Kim ACPI_STATUS Status; 6150d84335fSJung-uk Kim ACPI_COMMENT_ADDR_NODE *AddrListHead; 616f8146b88SJung-uk Kim 617f8146b88SJung-uk Kim 618f8146b88SJung-uk Kim fprintf (stderr, 619f8146b88SJung-uk Kim "\nFound %u external control methods, " 620f8146b88SJung-uk Kim "reparsing with new information\n", 621af051161SJung-uk Kim AcpiDmGetUnresolvedExternalMethodCount ()); 622f8146b88SJung-uk Kim 623f8146b88SJung-uk Kim /* Reparse, rebuild namespace */ 624f8146b88SJung-uk Kim 625f8146b88SJung-uk Kim AcpiPsDeleteParseTree (AcpiGbl_ParseOpRoot); 626f8146b88SJung-uk Kim AcpiGbl_ParseOpRoot = NULL; 627f8146b88SJung-uk Kim AcpiNsDeleteNamespaceSubtree (AcpiGbl_RootNode); 628f8146b88SJung-uk Kim 629f8146b88SJung-uk Kim AcpiGbl_RootNode = NULL; 630f8146b88SJung-uk Kim AcpiGbl_RootNodeStruct.Name.Integer = ACPI_ROOT_NAME; 631f8146b88SJung-uk Kim AcpiGbl_RootNodeStruct.DescriptorType = ACPI_DESC_TYPE_NAMED; 632f8146b88SJung-uk Kim AcpiGbl_RootNodeStruct.Type = ACPI_TYPE_DEVICE; 633f8146b88SJung-uk Kim AcpiGbl_RootNodeStruct.Parent = NULL; 634f8146b88SJung-uk Kim AcpiGbl_RootNodeStruct.Child = NULL; 635f8146b88SJung-uk Kim AcpiGbl_RootNodeStruct.Peer = NULL; 636f8146b88SJung-uk Kim AcpiGbl_RootNodeStruct.Object = NULL; 637f8146b88SJung-uk Kim AcpiGbl_RootNodeStruct.Flags = 0; 638f8146b88SJung-uk Kim 639f8146b88SJung-uk Kim Status = AcpiNsRootInitialize (); 640f8146b88SJung-uk Kim if (ACPI_FAILURE (Status)) 641f8146b88SJung-uk Kim { 642f8146b88SJung-uk Kim return (Status); 643a9f12690SJung-uk Kim } 644a9f12690SJung-uk Kim 645f8146b88SJung-uk Kim /* New namespace, add the external definitions first */ 646f8146b88SJung-uk Kim 647af051161SJung-uk Kim AcpiDmAddExternalListToNamespace (); 648f8146b88SJung-uk Kim 6490d84335fSJung-uk Kim /* For -ca option: clear the list of comment addresses. */ 6500d84335fSJung-uk Kim 6510d84335fSJung-uk Kim while (AcpiGbl_CommentAddrListHead) 6520d84335fSJung-uk Kim { 6530d84335fSJung-uk Kim AddrListHead= AcpiGbl_CommentAddrListHead; 6540d84335fSJung-uk Kim AcpiGbl_CommentAddrListHead = AcpiGbl_CommentAddrListHead->Next; 6550d84335fSJung-uk Kim AcpiOsFree(AddrListHead); 6560d84335fSJung-uk Kim } 6570d84335fSJung-uk Kim 658f8146b88SJung-uk Kim /* Parse the table again. No need to reload it, however */ 659f8146b88SJung-uk Kim 660f8146b88SJung-uk Kim Status = AdParseTable (Table, NULL, FALSE, FALSE); 661f8146b88SJung-uk Kim if (ACPI_FAILURE (Status)) 662f8146b88SJung-uk Kim { 663f8146b88SJung-uk Kim AcpiOsPrintf ("Could not parse ACPI tables, %s\n", 664f8146b88SJung-uk Kim AcpiFormatException (Status)); 665f8146b88SJung-uk Kim return (Status); 666f8146b88SJung-uk Kim } 667f8146b88SJung-uk Kim 668f8146b88SJung-uk Kim /* Cross reference the namespace again */ 669f8146b88SJung-uk Kim 670f8146b88SJung-uk Kim AcpiDmFinishNamespaceLoad (AcpiGbl_ParseOpRoot, 671f8146b88SJung-uk Kim AcpiGbl_RootNode, OwnerId); 672f8146b88SJung-uk Kim 673f8146b88SJung-uk Kim AcpiDmCrossReferenceNamespace (AcpiGbl_ParseOpRoot, 674f8146b88SJung-uk Kim AcpiGbl_RootNode, OwnerId); 675f8146b88SJung-uk Kim 676f8146b88SJung-uk Kim /* Debug output - namespace and parse tree */ 677f8146b88SJung-uk Kim 678f8146b88SJung-uk Kim if (AslCompilerdebug) 679f8146b88SJung-uk Kim { 680f8146b88SJung-uk Kim AcpiOsPrintf ("/**** After second load and resource conversion\n"); 6811c0e1b6dSJung-uk Kim if (File) 68259db4265SNate Lawson { 683efcc2a30SJung-uk Kim NsSetupNamespaceListing (File); 684efcc2a30SJung-uk Kim NsDisplayNamespace (); 685ec3fc72fSJung-uk Kim } 686ec3fc72fSJung-uk Kim 687f8146b88SJung-uk Kim AcpiOsPrintf ("*****/\n"); 688f8146b88SJung-uk Kim AcpiDmDumpTree (AcpiGbl_ParseOpRoot); 68959db4265SNate Lawson } 69059db4265SNate Lawson 6918ef1a331SJung-uk Kim return (AE_OK); 69259db4265SNate Lawson } 69359db4265SNate Lawson 69459db4265SNate Lawson 695f8146b88SJung-uk Kim /****************************************************************************** 6967cf3e94aSJung-uk Kim * 697f8146b88SJung-uk Kim * FUNCTION: AdDoExternalFileList 6987cf3e94aSJung-uk Kim * 699f8146b88SJung-uk Kim * PARAMETERS: Filename - Input file for the table 7007cf3e94aSJung-uk Kim * 701f8146b88SJung-uk Kim * RETURN: Status 7027cf3e94aSJung-uk Kim * 703f8146b88SJung-uk Kim * DESCRIPTION: Process all tables found in the -e external files list 7047cf3e94aSJung-uk Kim * 705f8146b88SJung-uk Kim *****************************************************************************/ 7067cf3e94aSJung-uk Kim 7077cf3e94aSJung-uk Kim static ACPI_STATUS 708f8146b88SJung-uk Kim AdDoExternalFileList ( 709f8146b88SJung-uk Kim char *Filename) 7107cf3e94aSJung-uk Kim { 711f8146b88SJung-uk Kim ACPI_EXTERNAL_FILE *ExternalFileList; 712f8146b88SJung-uk Kim char *ExternalFilename; 713f8146b88SJung-uk Kim ACPI_NEW_TABLE_DESC *ExternalListHead = NULL; 7147cf3e94aSJung-uk Kim ACPI_STATUS Status; 715f8146b88SJung-uk Kim ACPI_STATUS GlobalStatus = AE_OK; 716f8146b88SJung-uk Kim ACPI_OWNER_ID OwnerId; 7177cf3e94aSJung-uk Kim 7187cf3e94aSJung-uk Kim 719f8146b88SJung-uk Kim /* 720f8146b88SJung-uk Kim * External filenames are specified on the command line like this: 721f8146b88SJung-uk Kim * Example: iasl -e file1,file2,file3 -d xxx.aml 722f8146b88SJung-uk Kim */ 723f8146b88SJung-uk Kim ExternalFileList = AcpiGbl_ExternalFileList; 724f8146b88SJung-uk Kim 725f8146b88SJung-uk Kim /* Process each external file */ 726f8146b88SJung-uk Kim 727f8146b88SJung-uk Kim while (ExternalFileList) 728f8146b88SJung-uk Kim { 729f8146b88SJung-uk Kim ExternalFilename = ExternalFileList->Path; 730f8146b88SJung-uk Kim if (!strcmp (ExternalFilename, Filename)) 731f8146b88SJung-uk Kim { 732f8146b88SJung-uk Kim /* Next external file */ 733f8146b88SJung-uk Kim 734f8146b88SJung-uk Kim ExternalFileList = ExternalFileList->Next; 735f8146b88SJung-uk Kim continue; 736f8146b88SJung-uk Kim } 737f8146b88SJung-uk Kim 738f8146b88SJung-uk Kim AcpiOsPrintf ("External object resolution file %16s\n", 739f8146b88SJung-uk Kim ExternalFilename); 740f8146b88SJung-uk Kim 741f8146b88SJung-uk Kim Status = AcGetAllTablesFromFile ( 742f8146b88SJung-uk Kim ExternalFilename, ACPI_GET_ONLY_AML_TABLES, &ExternalListHead); 7437cf3e94aSJung-uk Kim if (ACPI_FAILURE (Status)) 7447cf3e94aSJung-uk Kim { 745f8146b88SJung-uk Kim if (Status == AE_TYPE) 746f8146b88SJung-uk Kim { 747f8146b88SJung-uk Kim ExternalFileList = ExternalFileList->Next; 748f8146b88SJung-uk Kim GlobalStatus = AE_TYPE; 749f8146b88SJung-uk Kim Status = AE_OK; 750f8146b88SJung-uk Kim continue; 751f8146b88SJung-uk Kim } 752f8146b88SJung-uk Kim 7535f9b24faSJung-uk Kim AcDeleteTableList (ExternalListHead); 7547cf3e94aSJung-uk Kim return (Status); 7557cf3e94aSJung-uk Kim } 7567cf3e94aSJung-uk Kim 757f8146b88SJung-uk Kim /* Load external tables for symbol resolution */ 7587cf3e94aSJung-uk Kim 759f8146b88SJung-uk Kim while (ExternalListHead) 76059db4265SNate Lawson { 761f8146b88SJung-uk Kim Status = AdParseTable ( 762f8146b88SJung-uk Kim ExternalListHead->Table, &OwnerId, TRUE, TRUE); 763f556842eSJung-uk Kim if (ACPI_FAILURE (Status)) 764f556842eSJung-uk Kim { 765f8146b88SJung-uk Kim AcpiOsPrintf ("Could not parse external ACPI tables, %s\n", 766f8146b88SJung-uk Kim AcpiFormatException (Status)); 7675f9b24faSJung-uk Kim AcDeleteTableList (ExternalListHead); 76859db4265SNate Lawson return (Status); 76959db4265SNate Lawson } 77059db4265SNate Lawson 771313a0c13SJung-uk Kim /* 772f8146b88SJung-uk Kim * Load namespace from names created within control methods 773f8146b88SJung-uk Kim * Set owner id of nodes in external table 774313a0c13SJung-uk Kim */ 775f8146b88SJung-uk Kim AcpiDmFinishNamespaceLoad (AcpiGbl_ParseOpRoot, 776f8146b88SJung-uk Kim AcpiGbl_RootNode, OwnerId); 777f8146b88SJung-uk Kim AcpiPsDeleteParseTree (AcpiGbl_ParseOpRoot); 7781a39cfb0SJung-uk Kim 779f8146b88SJung-uk Kim ExternalListHead = ExternalListHead->Next; 780f8146b88SJung-uk Kim } 7811a39cfb0SJung-uk Kim 782f8146b88SJung-uk Kim /* Next external file */ 78359db4265SNate Lawson 784f8146b88SJung-uk Kim ExternalFileList = ExternalFileList->Next; 785f8146b88SJung-uk Kim } 786f8146b88SJung-uk Kim 7875f9b24faSJung-uk Kim AcDeleteTableList (ExternalListHead); 7885f9b24faSJung-uk Kim 789f8146b88SJung-uk Kim if (ACPI_FAILURE (GlobalStatus)) 790f8146b88SJung-uk Kim { 791f8146b88SJung-uk Kim return (GlobalStatus); 792f8146b88SJung-uk Kim } 793f8146b88SJung-uk Kim 794f8146b88SJung-uk Kim /* Clear external list generated by Scope in external tables */ 795f8146b88SJung-uk Kim 796f8146b88SJung-uk Kim if (AcpiGbl_ExternalFileList) 797f8146b88SJung-uk Kim { 798f8146b88SJung-uk Kim AcpiDmClearExternalList (); 799f8146b88SJung-uk Kim } 800f8146b88SJung-uk Kim 801f8146b88SJung-uk Kim /* Load any externals defined in the optional external ref file */ 802f8146b88SJung-uk Kim 803f8146b88SJung-uk Kim AcpiDmGetExternalsFromFile (); 8048ef1a331SJung-uk Kim return (AE_OK); 80559db4265SNate Lawson } 806