adisasm.c 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728
  1. /******************************************************************************
  2. *
  3. * Module Name: adisasm - Application-level disassembler routines
  4. *
  5. *****************************************************************************/
  6. /******************************************************************************
  7. *
  8. * 1. Copyright Notice
  9. *
  10. * Some or all of this work - Copyright (c) 1999 - 2016, Intel Corp.
  11. * All rights reserved.
  12. *
  13. * 2. License
  14. *
  15. * 2.1. This is your license from Intel Corp. under its intellectual property
  16. * rights. You may have additional license terms from the party that provided
  17. * you this software, covering your right to use that party's intellectual
  18. * property rights.
  19. *
  20. * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
  21. * copy of the source code appearing in this file ("Covered Code") an
  22. * irrevocable, perpetual, worldwide license under Intel's copyrights in the
  23. * base code distributed originally by Intel ("Original Intel Code") to copy,
  24. * make derivatives, distribute, use and display any portion of the Covered
  25. * Code in any form, with the right to sublicense such rights; and
  26. *
  27. * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
  28. * license (with the right to sublicense), under only those claims of Intel
  29. * patents that are infringed by the Original Intel Code, to make, use, sell,
  30. * offer to sell, and import the Covered Code and derivative works thereof
  31. * solely to the minimum extent necessary to exercise the above copyright
  32. * license, and in no event shall the patent license extend to any additions
  33. * to or modifications of the Original Intel Code. No other license or right
  34. * is granted directly or by implication, estoppel or otherwise;
  35. *
  36. * The above copyright and patent license is granted only if the following
  37. * conditions are met:
  38. *
  39. * 3. Conditions
  40. *
  41. * 3.1. Redistribution of Source with Rights to Further Distribute Source.
  42. * Redistribution of source code of any substantial portion of the Covered
  43. * Code or modification with rights to further distribute source must include
  44. * the above Copyright Notice, the above License, this list of Conditions,
  45. * and the following Disclaimer and Export Compliance provision. In addition,
  46. * Licensee must cause all Covered Code to which Licensee contributes to
  47. * contain a file documenting the changes Licensee made to create that Covered
  48. * Code and the date of any change. Licensee must include in that file the
  49. * documentation of any changes made by any predecessor Licensee. Licensee
  50. * must include a prominent statement that the modification is derived,
  51. * directly or indirectly, from Original Intel Code.
  52. *
  53. * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
  54. * Redistribution of source code of any substantial portion of the Covered
  55. * Code or modification without rights to further distribute source must
  56. * include the following Disclaimer and Export Compliance provision in the
  57. * documentation and/or other materials provided with distribution. In
  58. * addition, Licensee may not authorize further sublicense of source of any
  59. * portion of the Covered Code, and must include terms to the effect that the
  60. * license from Licensee to its licensee is limited to the intellectual
  61. * property embodied in the software Licensee provides to its licensee, and
  62. * not to intellectual property embodied in modifications its licensee may
  63. * make.
  64. *
  65. * 3.3. Redistribution of Executable. Redistribution in executable form of any
  66. * substantial portion of the Covered Code or modification must reproduce the
  67. * above Copyright Notice, and the following Disclaimer and Export Compliance
  68. * provision in the documentation and/or other materials provided with the
  69. * distribution.
  70. *
  71. * 3.4. Intel retains all right, title, and interest in and to the Original
  72. * Intel Code.
  73. *
  74. * 3.5. Neither the name Intel nor any other trademark owned or controlled by
  75. * Intel shall be used in advertising or otherwise to promote the sale, use or
  76. * other dealings in products derived from or relating to the Covered Code
  77. * without prior written authorization from Intel.
  78. *
  79. * 4. Disclaimer and Export Compliance
  80. *
  81. * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
  82. * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
  83. * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
  84. * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
  85. * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
  86. * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
  87. * PARTICULAR PURPOSE.
  88. *
  89. * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
  90. * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
  91. * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
  92. * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
  93. * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
  94. * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
  95. * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
  96. * LIMITED REMEDY.
  97. *
  98. * 4.3. Licensee shall not export, either directly or indirectly, any of this
  99. * software or system incorporating such software without first obtaining any
  100. * required license or other approval from the U. S. Department of Commerce or
  101. * any other agency or department of the United States Government. In the
  102. * event Licensee exports any such software from the United States or
  103. * re-exports any such software from a foreign destination, Licensee shall
  104. * ensure that the distribution and export/re-export of the software is in
  105. * compliance with all laws, regulations, orders, or other restrictions of the
  106. * U.S. Export Administration Regulations. Licensee agrees that neither it nor
  107. * any of its subsidiaries will export/re-export any technical data, process,
  108. * software, or service, directly or indirectly, to any country for which the
  109. * United States government or any agency thereof requires an export license,
  110. * other governmental approval, or letter of assurance, without first obtaining
  111. * such license, approval or letter.
  112. *
  113. *****************************************************************************/
  114. #include "aslcompiler.h"
  115. #include "amlcode.h"
  116. #include "acdisasm.h"
  117. #include "acdispat.h"
  118. #include "acnamesp.h"
  119. #include "acparser.h"
  120. #include "acapps.h"
  121. #include <stdio.h>
  122. #define _COMPONENT ACPI_TOOLS
  123. ACPI_MODULE_NAME ("adisasm")
  124. /* Local prototypes */
  125. static ACPI_STATUS
  126. AdDoExternalFileList (
  127. char *Filename);
  128. static ACPI_STATUS
  129. AdDisassembleOneTable (
  130. ACPI_TABLE_HEADER *Table,
  131. FILE *File,
  132. char *Filename,
  133. char *DisasmFilename);
  134. static ACPI_STATUS
  135. AdReparseOneTable (
  136. ACPI_TABLE_HEADER *Table,
  137. FILE *File,
  138. ACPI_OWNER_ID OwnerId);
  139. ACPI_TABLE_DESC LocalTables[1];
  140. ACPI_PARSE_OBJECT *AcpiGbl_ParseOpRoot;
  141. /* Stubs for everything except ASL compiler */
  142. #ifndef ACPI_ASL_COMPILER
  143. BOOLEAN
  144. AcpiDsIsResultUsed (
  145. ACPI_PARSE_OBJECT *Op,
  146. ACPI_WALK_STATE *WalkState)
  147. {
  148. return (TRUE);
  149. }
  150. ACPI_STATUS
  151. AcpiDsMethodError (
  152. ACPI_STATUS Status,
  153. ACPI_WALK_STATE *WalkState)
  154. {
  155. return (Status);
  156. }
  157. #endif
  158. /*******************************************************************************
  159. *
  160. * FUNCTION: AdInitialize
  161. *
  162. * PARAMETERS: None
  163. *
  164. * RETURN: Status
  165. *
  166. * DESCRIPTION: ACPICA and local initialization
  167. *
  168. ******************************************************************************/
  169. ACPI_STATUS
  170. AdInitialize (
  171. void)
  172. {
  173. ACPI_STATUS Status;
  174. /* ACPICA subsystem initialization */
  175. Status = AcpiOsInitialize ();
  176. if (ACPI_FAILURE (Status))
  177. {
  178. return (Status);
  179. }
  180. Status = AcpiUtInitGlobals ();
  181. if (ACPI_FAILURE (Status))
  182. {
  183. return (Status);
  184. }
  185. Status = AcpiUtMutexInitialize ();
  186. if (ACPI_FAILURE (Status))
  187. {
  188. return (Status);
  189. }
  190. Status = AcpiNsRootInitialize ();
  191. if (ACPI_FAILURE (Status))
  192. {
  193. return (Status);
  194. }
  195. /* Setup the Table Manager (cheat - there is no RSDT) */
  196. AcpiGbl_RootTableList.MaxTableCount = 1;
  197. AcpiGbl_RootTableList.CurrentTableCount = 0;
  198. AcpiGbl_RootTableList.Tables = LocalTables;
  199. return (Status);
  200. }
  201. /******************************************************************************
  202. *
  203. * FUNCTION: AdAmlDisassemble
  204. *
  205. * PARAMETERS: Filename - AML input filename
  206. * OutToFile - TRUE if output should go to a file
  207. * Prefix - Path prefix for output
  208. * OutFilename - where the filename is returned
  209. *
  210. * RETURN: Status
  211. *
  212. * DESCRIPTION: Disassembler entry point. Disassemble an entire ACPI table.
  213. *
  214. *****************************************************************************/
  215. ACPI_STATUS
  216. AdAmlDisassemble (
  217. BOOLEAN OutToFile,
  218. char *Filename,
  219. char *Prefix,
  220. char **OutFilename)
  221. {
  222. ACPI_STATUS Status;
  223. char *DisasmFilename = NULL;
  224. FILE *File = NULL;
  225. ACPI_TABLE_HEADER *Table = NULL;
  226. ACPI_NEW_TABLE_DESC *ListHead = NULL;
  227. /*
  228. * Input: AML code from either a file or via GetTables (memory or
  229. * registry)
  230. */
  231. if (Filename)
  232. {
  233. /* Get the list of all AML tables in the file */
  234. Status = AcGetAllTablesFromFile (Filename,
  235. ACPI_GET_ALL_TABLES, &ListHead);
  236. if (ACPI_FAILURE (Status))
  237. {
  238. AcpiOsPrintf ("Could not get ACPI tables from %s, %s\n",
  239. Filename, AcpiFormatException (Status));
  240. return (Status);
  241. }
  242. /* Process any user-specified files for external objects */
  243. Status = AdDoExternalFileList (Filename);
  244. if (ACPI_FAILURE (Status))
  245. {
  246. return (Status);
  247. }
  248. }
  249. else
  250. {
  251. Status = AdGetLocalTables ();
  252. if (ACPI_FAILURE (Status))
  253. {
  254. AcpiOsPrintf ("Could not get ACPI tables, %s\n",
  255. AcpiFormatException (Status));
  256. return (Status);
  257. }
  258. if (!AcpiGbl_DmOpt_Disasm)
  259. {
  260. return (AE_OK);
  261. }
  262. /* Obtained the local tables, just disassemble the DSDT */
  263. Status = AcpiGetTable (ACPI_SIG_DSDT, 0, &Table);
  264. if (ACPI_FAILURE (Status))
  265. {
  266. AcpiOsPrintf ("Could not get DSDT, %s\n",
  267. AcpiFormatException (Status));
  268. return (Status);
  269. }
  270. AcpiOsPrintf ("\nDisassembly of DSDT\n");
  271. Prefix = AdGenerateFilename ("dsdt", Table->OemTableId);
  272. }
  273. /*
  274. * Output: ASL code. Redirect to a file if requested
  275. */
  276. if (OutToFile)
  277. {
  278. /* Create/Open a disassembly output file */
  279. DisasmFilename = FlGenerateFilename (Prefix, FILE_SUFFIX_DISASSEMBLY);
  280. if (!DisasmFilename)
  281. {
  282. fprintf (stderr, "Could not generate output filename\n");
  283. Status = AE_ERROR;
  284. goto Cleanup;
  285. }
  286. File = fopen (DisasmFilename, "w+");
  287. if (!File)
  288. {
  289. fprintf (stderr, "Could not open output file %s\n",
  290. DisasmFilename);
  291. Status = AE_ERROR;
  292. goto Cleanup;
  293. }
  294. AcpiOsRedirectOutput (File);
  295. }
  296. *OutFilename = DisasmFilename;
  297. /* Disassemble all AML tables within the file */
  298. while (ListHead)
  299. {
  300. Status = AdDisassembleOneTable (ListHead->Table,
  301. File, Filename, DisasmFilename);
  302. if (ACPI_FAILURE (Status))
  303. {
  304. break;
  305. }
  306. ListHead = ListHead->Next;
  307. }
  308. Cleanup:
  309. if (Table &&
  310. !AcpiGbl_ForceAmlDisassembly &&
  311. !AcpiUtIsAmlTable (Table))
  312. {
  313. ACPI_FREE (Table);
  314. }
  315. if (File)
  316. {
  317. fclose (File);
  318. AcpiOsRedirectOutput (stdout);
  319. }
  320. AcpiPsDeleteParseTree (AcpiGbl_ParseOpRoot);
  321. AcpiGbl_ParseOpRoot = NULL;
  322. return (Status);
  323. }
  324. /******************************************************************************
  325. *
  326. * FUNCTION: AdDisassembleOneTable
  327. *
  328. * PARAMETERS: Table - Raw AML table
  329. * File - Pointer for the input file
  330. * Filename - AML input filename
  331. * DisasmFilename - Output filename
  332. *
  333. * RETURN: Status
  334. *
  335. * DESCRIPTION: Disassemble a single ACPI table. AML or data table.
  336. *
  337. *****************************************************************************/
  338. static ACPI_STATUS
  339. AdDisassembleOneTable (
  340. ACPI_TABLE_HEADER *Table,
  341. FILE *File,
  342. char *Filename,
  343. char *DisasmFilename)
  344. {
  345. ACPI_STATUS Status;
  346. ACPI_OWNER_ID OwnerId;
  347. /* ForceAmlDisassembly means to assume the table contains valid AML */
  348. if (!AcpiGbl_ForceAmlDisassembly && !AcpiUtIsAmlTable (Table))
  349. {
  350. AdDisassemblerHeader (Filename, ACPI_IS_DATA_TABLE);
  351. /* This is a "Data Table" (non-AML table) */
  352. AcpiOsPrintf (" * ACPI Data Table [%4.4s]\n *\n",
  353. Table->Signature);
  354. AcpiOsPrintf (" * Format: [HexOffset DecimalOffset ByteLength] "
  355. "FieldName : FieldValue\n */\n\n");
  356. AcpiDmDumpDataTable (Table);
  357. fprintf (stderr, "Acpi Data Table [%4.4s] decoded\n",
  358. Table->Signature);
  359. if (File)
  360. {
  361. fprintf (stderr, "Formatted output: %s - %u bytes\n",
  362. DisasmFilename, CmGetFileSize (File));
  363. }
  364. return (AE_OK);
  365. }
  366. /*
  367. * This is an AML table (DSDT or SSDT).
  368. * Always parse the tables, only option is what to display
  369. */
  370. Status = AdParseTable (Table, &OwnerId, TRUE, FALSE);
  371. if (ACPI_FAILURE (Status))
  372. {
  373. AcpiOsPrintf ("Could not parse ACPI tables, %s\n",
  374. AcpiFormatException (Status));
  375. return (Status);
  376. }
  377. /* Debug output, namespace and parse tree */
  378. if (AslCompilerdebug && File)
  379. {
  380. AcpiOsPrintf ("/**** Before second load\n");
  381. NsSetupNamespaceListing (File);
  382. NsDisplayNamespace ();
  383. AcpiOsPrintf ("*****/\n");
  384. }
  385. /* Load namespace from names created within control methods */
  386. AcpiDmFinishNamespaceLoad (AcpiGbl_ParseOpRoot,
  387. AcpiGbl_RootNode, OwnerId);
  388. /*
  389. * Cross reference the namespace here, in order to
  390. * generate External() statements
  391. */
  392. AcpiDmCrossReferenceNamespace (AcpiGbl_ParseOpRoot,
  393. AcpiGbl_RootNode, OwnerId);
  394. if (AslCompilerdebug)
  395. {
  396. AcpiDmDumpTree (AcpiGbl_ParseOpRoot);
  397. }
  398. /* Find possible calls to external control methods */
  399. AcpiDmFindOrphanMethods (AcpiGbl_ParseOpRoot);
  400. /*
  401. * If we found any external control methods, we must reparse
  402. * the entire tree with the new information (namely, the
  403. * number of arguments per method)
  404. */
  405. if (AcpiDmGetExternalMethodCount ())
  406. {
  407. Status = AdReparseOneTable (Table, File, OwnerId);
  408. if (ACPI_FAILURE (Status))
  409. {
  410. return (Status);
  411. }
  412. }
  413. /*
  414. * Now that the namespace is finalized, we can perform namespace
  415. * transforms.
  416. *
  417. * 1) Convert fixed-offset references to resource descriptors
  418. * to symbolic references (Note: modifies namespace)
  419. */
  420. AcpiDmConvertResourceIndexes (AcpiGbl_ParseOpRoot, AcpiGbl_RootNode);
  421. /* Optional displays */
  422. if (AcpiGbl_DmOpt_Disasm)
  423. {
  424. /* This is the real disassembly */
  425. AdDisplayTables (Filename, Table);
  426. /* Dump hex table if requested (-vt) */
  427. AcpiDmDumpDataTable (Table);
  428. fprintf (stderr, "Disassembly completed\n");
  429. if (File)
  430. {
  431. fprintf (stderr, "ASL Output: %s - %u bytes\n",
  432. DisasmFilename, CmGetFileSize (File));
  433. }
  434. if (Gbl_MapfileFlag)
  435. {
  436. fprintf (stderr, "%14s %s - %u bytes\n",
  437. Gbl_Files[ASL_FILE_MAP_OUTPUT].ShortDescription,
  438. Gbl_Files[ASL_FILE_MAP_OUTPUT].Filename,
  439. FlGetFileSize (ASL_FILE_MAP_OUTPUT));
  440. }
  441. }
  442. return (AE_OK);
  443. }
  444. /******************************************************************************
  445. *
  446. * FUNCTION: AdReparseOneTable
  447. *
  448. * PARAMETERS: Table - Raw AML table
  449. * File - Pointer for the input file
  450. * OwnerId - ID for this table
  451. *
  452. * RETURN: Status
  453. *
  454. * DESCRIPTION: Reparse a table that has already been loaded. Used to
  455. * integrate information about external control methods.
  456. * These methods may have been previously parsed incorrectly.
  457. *
  458. *****************************************************************************/
  459. static ACPI_STATUS
  460. AdReparseOneTable (
  461. ACPI_TABLE_HEADER *Table,
  462. FILE *File,
  463. ACPI_OWNER_ID OwnerId)
  464. {
  465. ACPI_STATUS Status;
  466. fprintf (stderr,
  467. "\nFound %u external control methods, "
  468. "reparsing with new information\n",
  469. AcpiDmGetExternalMethodCount ());
  470. /* Reparse, rebuild namespace */
  471. AcpiPsDeleteParseTree (AcpiGbl_ParseOpRoot);
  472. AcpiGbl_ParseOpRoot = NULL;
  473. AcpiNsDeleteNamespaceSubtree (AcpiGbl_RootNode);
  474. AcpiGbl_RootNode = NULL;
  475. AcpiGbl_RootNodeStruct.Name.Integer = ACPI_ROOT_NAME;
  476. AcpiGbl_RootNodeStruct.DescriptorType = ACPI_DESC_TYPE_NAMED;
  477. AcpiGbl_RootNodeStruct.Type = ACPI_TYPE_DEVICE;
  478. AcpiGbl_RootNodeStruct.Parent = NULL;
  479. AcpiGbl_RootNodeStruct.Child = NULL;
  480. AcpiGbl_RootNodeStruct.Peer = NULL;
  481. AcpiGbl_RootNodeStruct.Object = NULL;
  482. AcpiGbl_RootNodeStruct.Flags = 0;
  483. Status = AcpiNsRootInitialize ();
  484. if (ACPI_FAILURE (Status))
  485. {
  486. return (Status);
  487. }
  488. /* New namespace, add the external definitions first */
  489. AcpiDmAddExternalsToNamespace ();
  490. /* Parse the table again. No need to reload it, however */
  491. Status = AdParseTable (Table, NULL, FALSE, FALSE);
  492. if (ACPI_FAILURE (Status))
  493. {
  494. AcpiOsPrintf ("Could not parse ACPI tables, %s\n",
  495. AcpiFormatException (Status));
  496. return (Status);
  497. }
  498. /* Cross reference the namespace again */
  499. AcpiDmFinishNamespaceLoad (AcpiGbl_ParseOpRoot,
  500. AcpiGbl_RootNode, OwnerId);
  501. AcpiDmCrossReferenceNamespace (AcpiGbl_ParseOpRoot,
  502. AcpiGbl_RootNode, OwnerId);
  503. /* Debug output - namespace and parse tree */
  504. if (AslCompilerdebug)
  505. {
  506. AcpiOsPrintf ("/**** After second load and resource conversion\n");
  507. if (File)
  508. {
  509. NsSetupNamespaceListing (File);
  510. NsDisplayNamespace ();
  511. }
  512. AcpiOsPrintf ("*****/\n");
  513. AcpiDmDumpTree (AcpiGbl_ParseOpRoot);
  514. }
  515. return (AE_OK);
  516. }
  517. /******************************************************************************
  518. *
  519. * FUNCTION: AdDoExternalFileList
  520. *
  521. * PARAMETERS: Filename - Input file for the table
  522. *
  523. * RETURN: Status
  524. *
  525. * DESCRIPTION: Process all tables found in the -e external files list
  526. *
  527. *****************************************************************************/
  528. static ACPI_STATUS
  529. AdDoExternalFileList (
  530. char *Filename)
  531. {
  532. ACPI_EXTERNAL_FILE *ExternalFileList;
  533. char *ExternalFilename;
  534. ACPI_NEW_TABLE_DESC *ExternalListHead = NULL;
  535. ACPI_STATUS Status;
  536. ACPI_STATUS GlobalStatus = AE_OK;
  537. ACPI_OWNER_ID OwnerId;
  538. /*
  539. * External filenames are specified on the command line like this:
  540. * Example: iasl -e file1,file2,file3 -d xxx.aml
  541. */
  542. ExternalFileList = AcpiGbl_ExternalFileList;
  543. /* Process each external file */
  544. while (ExternalFileList)
  545. {
  546. ExternalFilename = ExternalFileList->Path;
  547. if (!strcmp (ExternalFilename, Filename))
  548. {
  549. /* Next external file */
  550. ExternalFileList = ExternalFileList->Next;
  551. continue;
  552. }
  553. AcpiOsPrintf ("External object resolution file %16s\n",
  554. ExternalFilename);
  555. Status = AcGetAllTablesFromFile (
  556. ExternalFilename, ACPI_GET_ONLY_AML_TABLES, &ExternalListHead);
  557. if (ACPI_FAILURE (Status))
  558. {
  559. if (Status == AE_TYPE)
  560. {
  561. ExternalFileList = ExternalFileList->Next;
  562. GlobalStatus = AE_TYPE;
  563. Status = AE_OK;
  564. continue;
  565. }
  566. return (Status);
  567. }
  568. /* Load external tables for symbol resolution */
  569. while (ExternalListHead)
  570. {
  571. Status = AdParseTable (
  572. ExternalListHead->Table, &OwnerId, TRUE, TRUE);
  573. if (ACPI_FAILURE (Status))
  574. {
  575. AcpiOsPrintf ("Could not parse external ACPI tables, %s\n",
  576. AcpiFormatException (Status));
  577. return (Status);
  578. }
  579. /*
  580. * Load namespace from names created within control methods
  581. * Set owner id of nodes in external table
  582. */
  583. AcpiDmFinishNamespaceLoad (AcpiGbl_ParseOpRoot,
  584. AcpiGbl_RootNode, OwnerId);
  585. AcpiPsDeleteParseTree (AcpiGbl_ParseOpRoot);
  586. ExternalListHead = ExternalListHead->Next;
  587. }
  588. /* Next external file */
  589. ExternalFileList = ExternalFileList->Next;
  590. }
  591. if (ACPI_FAILURE (GlobalStatus))
  592. {
  593. return (GlobalStatus);
  594. }
  595. /* Clear external list generated by Scope in external tables */
  596. if (AcpiGbl_ExternalFileList)
  597. {
  598. AcpiDmClearExternalList ();
  599. }
  600. /* Load any externals defined in the optional external ref file */
  601. AcpiDmGetExternalsFromFile ();
  602. return (AE_OK);
  603. }