Home | History | Annotate | Line # | Download | only in common
dmtables.c revision 1.9
      1  1.1  christos /******************************************************************************
      2  1.1  christos  *
      3  1.1  christos  * Module Name: dmtables - disassembler ACPI table support
      4  1.1  christos  *
      5  1.1  christos  *****************************************************************************/
      6  1.1  christos 
      7  1.1  christos /*
      8  1.8  christos  * Copyright (C) 2000 - 2023, Intel Corp.
      9  1.1  christos  * All rights reserved.
     10  1.1  christos  *
     11  1.1  christos  * Redistribution and use in source and binary forms, with or without
     12  1.1  christos  * modification, are permitted provided that the following conditions
     13  1.1  christos  * are met:
     14  1.1  christos  * 1. Redistributions of source code must retain the above copyright
     15  1.1  christos  *    notice, this list of conditions, and the following disclaimer,
     16  1.1  christos  *    without modification.
     17  1.1  christos  * 2. Redistributions in binary form must reproduce at minimum a disclaimer
     18  1.1  christos  *    substantially similar to the "NO WARRANTY" disclaimer below
     19  1.1  christos  *    ("Disclaimer") and any redistribution must be conditioned upon
     20  1.1  christos  *    including a substantially similar Disclaimer requirement for further
     21  1.1  christos  *    binary redistribution.
     22  1.1  christos  * 3. Neither the names of the above-listed copyright holders nor the names
     23  1.1  christos  *    of any contributors may be used to endorse or promote products derived
     24  1.1  christos  *    from this software without specific prior written permission.
     25  1.1  christos  *
     26  1.1  christos  * Alternatively, this software may be distributed under the terms of the
     27  1.1  christos  * GNU General Public License ("GPL") version 2 as published by the Free
     28  1.1  christos  * Software Foundation.
     29  1.1  christos  *
     30  1.1  christos  * NO WARRANTY
     31  1.1  christos  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
     32  1.1  christos  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
     33  1.5  christos  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
     34  1.1  christos  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
     35  1.1  christos  * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
     36  1.1  christos  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
     37  1.1  christos  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
     38  1.1  christos  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
     39  1.1  christos  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
     40  1.1  christos  * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     41  1.1  christos  * POSSIBILITY OF SUCH DAMAGES.
     42  1.1  christos  */
     43  1.1  christos 
     44  1.1  christos #include "aslcompiler.h"
     45  1.1  christos #include "acdispat.h"
     46  1.1  christos #include "acnamesp.h"
     47  1.1  christos #include "actables.h"
     48  1.1  christos #include "acparser.h"
     49  1.2  christos #include "acapps.h"
     50  1.2  christos #include "acmacros.h"
     51  1.2  christos #include "acconvert.h"
     52  1.1  christos 
     53  1.1  christos 
     54  1.1  christos #define _COMPONENT          ACPI_TOOLS
     55  1.1  christos         ACPI_MODULE_NAME    ("dmtables")
     56  1.1  christos 
     57  1.1  christos 
     58  1.1  christos /* Local prototypes */
     59  1.1  christos 
     60  1.1  christos static void
     61  1.1  christos AdCreateTableHeader (
     62  1.1  christos     char                    *Filename,
     63  1.1  christos     ACPI_TABLE_HEADER       *Table);
     64  1.1  christos 
     65  1.1  christos static ACPI_STATUS
     66  1.1  christos AdStoreTable (
     67  1.1  christos     ACPI_TABLE_HEADER       *Table,
     68  1.1  christos     UINT32                  *TableIndex);
     69  1.1  christos 
     70  1.1  christos 
     71  1.1  christos extern ACPI_TABLE_DESC      LocalTables[1];
     72  1.1  christos extern ACPI_PARSE_OBJECT    *AcpiGbl_ParseOpRoot;
     73  1.1  christos 
     74  1.1  christos 
     75  1.1  christos /******************************************************************************
     76  1.1  christos  *
     77  1.1  christos  * FUNCTION:    AdDisassemblerHeader
     78  1.1  christos  *
     79  1.1  christos  * PARAMETERS:  Filename            - Input file for the table
     80  1.1  christos  *              TableType           - Either AML or DataTable
     81  1.1  christos  *
     82  1.1  christos  * RETURN:      None
     83  1.1  christos  *
     84  1.1  christos  * DESCRIPTION: Create the disassembler header, including ACPICA signon with
     85  1.9  christos  *              optional current time and date.
     86  1.1  christos  *
     87  1.1  christos  *****************************************************************************/
     88  1.1  christos 
     89  1.1  christos void
     90  1.1  christos AdDisassemblerHeader (
     91  1.1  christos     char                    *Filename,
     92  1.1  christos     UINT8                   TableType)
     93  1.1  christos {
     94  1.1  christos     time_t                  Timer;
     95  1.1  christos 
     96  1.1  christos 
     97  1.1  christos     /* Header and input table info */
     98  1.1  christos 
     99  1.1  christos     AcpiOsPrintf ("/*\n");
    100  1.1  christos     AcpiOsPrintf (ACPI_COMMON_HEADER (AML_DISASSEMBLER_NAME, " * "));
    101  1.1  christos 
    102  1.1  christos     if (TableType == ACPI_IS_AML_TABLE)
    103  1.1  christos     {
    104  1.1  christos         if (AcpiGbl_CstyleDisassembly)
    105  1.1  christos         {
    106  1.1  christos             AcpiOsPrintf (
    107  1.1  christos                 " * Disassembling to symbolic ASL+ operators\n"
    108  1.1  christos                 " *\n");
    109  1.1  christos         }
    110  1.1  christos         else
    111  1.1  christos         {
    112  1.1  christos             AcpiOsPrintf (
    113  1.1  christos                 " * Disassembling to non-symbolic legacy ASL operators\n"
    114  1.1  christos                 " *\n");
    115  1.1  christos         }
    116  1.1  christos     }
    117  1.1  christos 
    118  1.9  christos     if (AslGbl_Deterministic)
    119  1.9  christos     {
    120  1.9  christos         AcpiOsPrintf (" * Disassembly of %s\n", Filename);
    121  1.9  christos     }
    122  1.9  christos     else
    123  1.9  christos     {
    124  1.9  christos         time (&Timer);
    125  1.9  christos         AcpiOsPrintf (" * Disassembly of %s, %s", Filename, ctime (&Timer));
    126  1.9  christos     }
    127  1.1  christos     AcpiOsPrintf (" *\n");
    128  1.1  christos }
    129  1.1  christos 
    130  1.1  christos 
    131  1.1  christos /******************************************************************************
    132  1.1  christos  *
    133  1.1  christos  * FUNCTION:    AdCreateTableHeader
    134  1.1  christos  *
    135  1.1  christos  * PARAMETERS:  Filename            - Input file for the table
    136  1.1  christos  *              Table               - Pointer to the raw table
    137  1.1  christos  *
    138  1.1  christos  * RETURN:      None
    139  1.1  christos  *
    140  1.1  christos  * DESCRIPTION: Create the ASL table header, including ACPICA signon with
    141  1.1  christos  *              current time and date.
    142  1.1  christos  *
    143  1.1  christos  *****************************************************************************/
    144  1.1  christos 
    145  1.1  christos static void
    146  1.1  christos AdCreateTableHeader (
    147  1.1  christos     char                    *Filename,
    148  1.1  christos     ACPI_TABLE_HEADER       *Table)
    149  1.1  christos {
    150  1.1  christos     UINT8                   Checksum;
    151  1.1  christos 
    152  1.1  christos 
    153  1.2  christos     /* Reset globals for External statements */
    154  1.2  christos 
    155  1.2  christos     AcpiGbl_NumExternalMethods = 0;
    156  1.2  christos     AcpiGbl_ResolvedExternalMethods = 0;
    157  1.2  christos 
    158  1.1  christos     /*
    159  1.1  christos      * Print file header and dump original table header
    160  1.1  christos      */
    161  1.1  christos     AdDisassemblerHeader (Filename, ACPI_IS_AML_TABLE);
    162  1.1  christos 
    163  1.1  christos     AcpiOsPrintf (" * Original Table Header:\n");
    164  1.1  christos     AcpiOsPrintf (" *     Signature        \"%4.4s\"\n",    Table->Signature);
    165  1.1  christos     AcpiOsPrintf (" *     Length           0x%8.8X (%u)\n", Table->Length, Table->Length);
    166  1.1  christos 
    167  1.1  christos     /* Print and validate the revision */
    168  1.1  christos 
    169  1.1  christos     AcpiOsPrintf (" *     Revision         0x%2.2X",      Table->Revision);
    170  1.1  christos 
    171  1.1  christos     switch (Table->Revision)
    172  1.1  christos     {
    173  1.1  christos     case 0:
    174  1.1  christos 
    175  1.1  christos         AcpiOsPrintf (" **** Invalid Revision");
    176  1.1  christos         break;
    177  1.1  christos 
    178  1.1  christos     case 1:
    179  1.1  christos 
    180  1.1  christos         /* Revision of DSDT controls the ACPI integer width */
    181  1.1  christos 
    182  1.2  christos         if (ACPI_COMPARE_NAMESEG (Table->Signature, ACPI_SIG_DSDT))
    183  1.1  christos         {
    184  1.1  christos             AcpiOsPrintf (" **** 32-bit table (V1), no 64-bit math support");
    185  1.1  christos         }
    186  1.1  christos         break;
    187  1.1  christos 
    188  1.1  christos     default:
    189  1.1  christos 
    190  1.1  christos         break;
    191  1.1  christos     }
    192  1.1  christos 
    193  1.1  christos     /* Print and validate the table checksum */
    194  1.1  christos 
    195  1.2  christos     AcpiOsPrintf ("\n *     Checksum         0x%2.2X",        Table->Checksum);
    196  1.1  christos 
    197  1.7  christos     Checksum = AcpiUtChecksum (ACPI_CAST_PTR (UINT8, Table), Table->Length);
    198  1.1  christos     if (Checksum)
    199  1.1  christos     {
    200  1.1  christos         AcpiOsPrintf (" **** Incorrect checksum, should be 0x%2.2X",
    201  1.1  christos             (UINT8) (Table->Checksum - Checksum));
    202  1.1  christos     }
    203  1.1  christos 
    204  1.1  christos     AcpiOsPrintf ("\n");
    205  1.1  christos     AcpiOsPrintf (" *     OEM ID           \"%.6s\"\n",     Table->OemId);
    206  1.1  christos     AcpiOsPrintf (" *     OEM Table ID     \"%.8s\"\n",     Table->OemTableId);
    207  1.1  christos     AcpiOsPrintf (" *     OEM Revision     0x%8.8X (%u)\n", Table->OemRevision, Table->OemRevision);
    208  1.1  christos     AcpiOsPrintf (" *     Compiler ID      \"%.4s\"\n",     Table->AslCompilerId);
    209  1.1  christos     AcpiOsPrintf (" *     Compiler Version 0x%8.8X (%u)\n", Table->AslCompilerRevision, Table->AslCompilerRevision);
    210  1.1  christos     AcpiOsPrintf (" */\n");
    211  1.1  christos 
    212  1.2  christos     /*
    213  1.2  christos      * Print comments that come before this definition block.
    214  1.2  christos      */
    215  1.2  christos     if (AcpiGbl_CaptureComments)
    216  1.1  christos     {
    217  1.2  christos         ASL_CV_PRINT_ONE_COMMENT(AcpiGbl_ParseOpRoot,AML_COMMENT_STANDARD, NULL, 0);
    218  1.1  christos     }
    219  1.1  christos 
    220  1.2  christos     /*
    221  1.2  christos      * Open the ASL definition block.
    222  1.2  christos      *
    223  1.2  christos      * Note: the AMLFilename string is left zero-length in order to just let
    224  1.2  christos      * the compiler create it when the disassembled file is compiled. This
    225  1.2  christos      * makes it easier to rename the disassembled ASL file if needed.
    226  1.2  christos      */
    227  1.1  christos     AcpiOsPrintf (
    228  1.3  christos         "DefinitionBlock (\"\", \"%4.4s\", %u, \"%.6s\", \"%.8s\", 0x%8.8X)\n",
    229  1.2  christos         Table->Signature, Table->Revision,
    230  1.1  christos         Table->OemId, Table->OemTableId, Table->OemRevision);
    231  1.1  christos }
    232  1.1  christos 
    233  1.1  christos 
    234  1.1  christos /******************************************************************************
    235  1.1  christos  *
    236  1.1  christos  * FUNCTION:    AdDisplayTables
    237  1.1  christos  *
    238  1.1  christos  * PARAMETERS:  Filename            - Input file for the table
    239  1.1  christos  *              Table               - Pointer to the raw table
    240  1.1  christos  *
    241  1.1  christos  * RETURN:      Status
    242  1.1  christos  *
    243  1.1  christos  * DESCRIPTION: Display (disassemble) loaded tables and dump raw tables
    244  1.1  christos  *
    245  1.1  christos  *****************************************************************************/
    246  1.1  christos 
    247  1.1  christos ACPI_STATUS
    248  1.1  christos AdDisplayTables (
    249  1.1  christos     char                    *Filename,
    250  1.1  christos     ACPI_TABLE_HEADER       *Table)
    251  1.1  christos {
    252  1.1  christos 
    253  1.1  christos 
    254  1.1  christos     if (!AcpiGbl_ParseOpRoot)
    255  1.1  christos     {
    256  1.1  christos         return (AE_NOT_EXIST);
    257  1.1  christos     }
    258  1.1  christos 
    259  1.1  christos     if (!AcpiGbl_DmOpt_Listing)
    260  1.1  christos     {
    261  1.1  christos         AdCreateTableHeader (Filename, Table);
    262  1.1  christos     }
    263  1.1  christos 
    264  1.1  christos     AcpiDmDisassemble (NULL, AcpiGbl_ParseOpRoot, ACPI_UINT32_MAX);
    265  1.1  christos     MpEmitMappingInfo ();
    266  1.1  christos 
    267  1.1  christos     if (AcpiGbl_DmOpt_Listing)
    268  1.1  christos     {
    269  1.1  christos         AcpiOsPrintf ("\n\nTable Header:\n");
    270  1.1  christos         AcpiUtDebugDumpBuffer ((UINT8 *) Table, sizeof (ACPI_TABLE_HEADER),
    271  1.1  christos             DB_BYTE_DISPLAY, ACPI_UINT32_MAX);
    272  1.1  christos 
    273  1.1  christos         AcpiOsPrintf ("Table Body (Length 0x%X)\n", Table->Length);
    274  1.1  christos         AcpiUtDebugDumpBuffer (((UINT8 *) Table + sizeof (ACPI_TABLE_HEADER)),
    275  1.1  christos             Table->Length, DB_BYTE_DISPLAY, ACPI_UINT32_MAX);
    276  1.1  christos     }
    277  1.1  christos 
    278  1.1  christos     return (AE_OK);
    279  1.1  christos }
    280  1.1  christos 
    281  1.1  christos 
    282  1.1  christos /*******************************************************************************
    283  1.1  christos  *
    284  1.1  christos  * FUNCTION:    AdStoreTable
    285  1.1  christos  *
    286  1.1  christos  * PARAMETERS:  Table               - Table header
    287  1.1  christos  *              TableIndex          - Where the table index is returned
    288  1.1  christos  *
    289  1.1  christos  * RETURN:      Status and table index.
    290  1.1  christos  *
    291  1.1  christos  * DESCRIPTION: Add an ACPI table to the global table list
    292  1.1  christos  *
    293  1.1  christos  ******************************************************************************/
    294  1.1  christos 
    295  1.1  christos static ACPI_STATUS
    296  1.1  christos AdStoreTable (
    297  1.1  christos     ACPI_TABLE_HEADER       *Table,
    298  1.1  christos     UINT32                  *TableIndex)
    299  1.1  christos {
    300  1.1  christos     ACPI_STATUS             Status;
    301  1.1  christos     ACPI_TABLE_DESC         *TableDesc;
    302  1.1  christos 
    303  1.1  christos 
    304  1.1  christos     Status = AcpiTbGetNextTableDescriptor (TableIndex, &TableDesc);
    305  1.1  christos     if (ACPI_FAILURE (Status))
    306  1.1  christos     {
    307  1.1  christos         return (Status);
    308  1.1  christos     }
    309  1.1  christos 
    310  1.1  christos     /* Initialize added table */
    311  1.1  christos 
    312  1.1  christos     AcpiTbInitTableDescriptor (TableDesc, ACPI_PTR_TO_PHYSADDR (Table),
    313  1.1  christos         ACPI_TABLE_ORIGIN_INTERNAL_VIRTUAL, Table);
    314  1.1  christos     Status = AcpiTbValidateTable (TableDesc);
    315  1.1  christos     return (Status);
    316  1.1  christos }
    317  1.1  christos 
    318  1.1  christos 
    319  1.1  christos /******************************************************************************
    320  1.1  christos  *
    321  1.1  christos  * FUNCTION:    AdGetLocalTables
    322  1.1  christos  *
    323  1.1  christos  * PARAMETERS:  None
    324  1.1  christos  *
    325  1.1  christos  * RETURN:      Status
    326  1.1  christos  *
    327  1.1  christos  * DESCRIPTION: Get the ACPI tables from either memory or a file
    328  1.1  christos  *
    329  1.1  christos  *****************************************************************************/
    330  1.1  christos 
    331  1.1  christos ACPI_STATUS
    332  1.1  christos AdGetLocalTables (
    333  1.1  christos     void)
    334  1.1  christos {
    335  1.1  christos     ACPI_STATUS             Status;
    336  1.1  christos     ACPI_TABLE_HEADER       TableHeader;
    337  1.1  christos     ACPI_TABLE_HEADER       *NewTable;
    338  1.1  christos     UINT32                  TableIndex;
    339  1.1  christos 
    340  1.1  christos 
    341  1.1  christos     /* Get the DSDT via table override */
    342  1.1  christos 
    343  1.1  christos     ACPI_MOVE_32_TO_32 (TableHeader.Signature, ACPI_SIG_DSDT);
    344  1.2  christos     Status = AcpiOsTableOverride (&TableHeader, &NewTable);
    345  1.2  christos     if (ACPI_FAILURE (Status) || !NewTable)
    346  1.1  christos     {
    347  1.1  christos         fprintf (stderr, "Could not obtain DSDT\n");
    348  1.1  christos         return (AE_NO_ACPI_TABLES);
    349  1.1  christos     }
    350  1.1  christos 
    351  1.1  christos     AdWriteTable (NewTable, NewTable->Length,
    352  1.1  christos         ACPI_SIG_DSDT, NewTable->OemTableId);
    353  1.1  christos 
    354  1.1  christos     /* Store DSDT in the Table Manager */
    355  1.1  christos 
    356  1.1  christos     Status = AdStoreTable (NewTable, &TableIndex);
    357  1.1  christos     if (ACPI_FAILURE (Status))
    358  1.1  christos     {
    359  1.1  christos         fprintf (stderr, "Could not store DSDT\n");
    360  1.1  christos         return (AE_NO_ACPI_TABLES);
    361  1.1  christos     }
    362  1.1  christos 
    363  1.1  christos     return (AE_OK);
    364  1.1  christos }
    365  1.1  christos 
    366  1.1  christos 
    367  1.1  christos /******************************************************************************
    368  1.1  christos  *
    369  1.1  christos  * FUNCTION:    AdParseTable
    370  1.1  christos  *
    371  1.1  christos  * PARAMETERS:  Table               - Pointer to the raw table
    372  1.1  christos  *              OwnerId             - Returned OwnerId of the table
    373  1.1  christos  *              LoadTable           - If add table to the global table list
    374  1.1  christos  *              External            - If this is an external table
    375  1.1  christos  *
    376  1.1  christos  * RETURN:      Status
    377  1.1  christos  *
    378  1.1  christos  * DESCRIPTION: Parse an ACPI AML table
    379  1.1  christos  *
    380  1.1  christos  *****************************************************************************/
    381  1.1  christos 
    382  1.1  christos ACPI_STATUS
    383  1.1  christos AdParseTable (
    384  1.1  christos     ACPI_TABLE_HEADER       *Table,
    385  1.1  christos     ACPI_OWNER_ID           *OwnerId,
    386  1.1  christos     BOOLEAN                 LoadTable,
    387  1.1  christos     BOOLEAN                 External)
    388  1.1  christos {
    389  1.1  christos     ACPI_STATUS             Status = AE_OK;
    390  1.1  christos     ACPI_WALK_STATE         *WalkState;
    391  1.1  christos     UINT8                   *AmlStart;
    392  1.1  christos     UINT32                  AmlLength;
    393  1.1  christos     UINT32                  TableIndex;
    394  1.1  christos 
    395  1.1  christos 
    396  1.1  christos     if (!Table)
    397  1.1  christos     {
    398  1.1  christos         return (AE_NOT_EXIST);
    399  1.1  christos     }
    400  1.1  christos 
    401  1.1  christos     /* Pass 1:  Parse everything except control method bodies */
    402  1.1  christos 
    403  1.1  christos     fprintf (stderr, "Pass 1 parse of [%4.4s]\n", (char *) Table->Signature);
    404  1.1  christos 
    405  1.1  christos     AmlLength = Table->Length - sizeof (ACPI_TABLE_HEADER);
    406  1.1  christos     AmlStart = ((UINT8 *) Table + sizeof (ACPI_TABLE_HEADER));
    407  1.1  christos 
    408  1.3  christos     AcpiUtSetIntegerWidth (Table->Revision);
    409  1.3  christos 
    410  1.1  christos     /* Create the root object */
    411  1.1  christos 
    412  1.1  christos     AcpiGbl_ParseOpRoot = AcpiPsCreateScopeOp (AmlStart);
    413  1.1  christos     if (!AcpiGbl_ParseOpRoot)
    414  1.1  christos     {
    415  1.1  christos         return (AE_NO_MEMORY);
    416  1.1  christos     }
    417  1.1  christos 
    418  1.2  christos #ifdef ACPI_ASL_COMPILER
    419  1.2  christos     if (AcpiGbl_CaptureComments)
    420  1.2  christos     {
    421  1.2  christos         AcpiGbl_ParseOpRoot->Common.CvFilename = AcpiGbl_FileTreeRoot->Filename;
    422  1.2  christos     }
    423  1.2  christos     else
    424  1.2  christos     {
    425  1.2  christos         AcpiGbl_ParseOpRoot->Common.CvFilename = NULL;
    426  1.2  christos     }
    427  1.2  christos #endif
    428  1.2  christos 
    429  1.1  christos     /* Create and initialize a new walk state */
    430  1.1  christos 
    431  1.1  christos     WalkState = AcpiDsCreateWalkState (0, AcpiGbl_ParseOpRoot, NULL, NULL);
    432  1.1  christos     if (!WalkState)
    433  1.1  christos     {
    434  1.1  christos         return (AE_NO_MEMORY);
    435  1.1  christos     }
    436  1.1  christos 
    437  1.1  christos     Status = AcpiDsInitAmlWalk (WalkState, AcpiGbl_ParseOpRoot,
    438  1.1  christos         NULL, AmlStart, AmlLength, NULL, ACPI_IMODE_LOAD_PASS1);
    439  1.1  christos     if (ACPI_FAILURE (Status))
    440  1.1  christos     {
    441  1.1  christos         return (Status);
    442  1.1  christos     }
    443  1.1  christos 
    444  1.1  christos     WalkState->ParseFlags &= ~ACPI_PARSE_DELETE_TREE;
    445  1.1  christos 
    446  1.1  christos     Status = AcpiPsParseAml (WalkState);
    447  1.1  christos     if (ACPI_FAILURE (Status))
    448  1.1  christos     {
    449  1.1  christos         return (Status);
    450  1.1  christos     }
    451  1.1  christos 
    452  1.1  christos     /* If LoadTable is FALSE, we are parsing the last loaded table */
    453  1.1  christos 
    454  1.1  christos     TableIndex = AcpiGbl_RootTableList.CurrentTableCount - 1;
    455  1.1  christos 
    456  1.1  christos     /* Pass 2 */
    457  1.1  christos 
    458  1.1  christos     if (LoadTable)
    459  1.1  christos     {
    460  1.1  christos         Status = AdStoreTable (Table, &TableIndex);
    461  1.1  christos         if (ACPI_FAILURE (Status))
    462  1.1  christos         {
    463  1.1  christos             return (Status);
    464  1.1  christos         }
    465  1.1  christos         Status = AcpiTbAllocateOwnerId (TableIndex);
    466  1.1  christos         if (ACPI_FAILURE (Status))
    467  1.1  christos         {
    468  1.1  christos             return (Status);
    469  1.1  christos         }
    470  1.1  christos         if (OwnerId)
    471  1.1  christos         {
    472  1.1  christos             Status = AcpiTbGetOwnerId (TableIndex, OwnerId);
    473  1.1  christos             if (ACPI_FAILURE (Status))
    474  1.1  christos             {
    475  1.1  christos                 return (Status);
    476  1.1  christos             }
    477  1.1  christos         }
    478  1.1  christos     }
    479  1.1  christos 
    480  1.1  christos     fprintf (stderr, "Pass 2 parse of [%4.4s]\n", (char *) Table->Signature);
    481  1.1  christos 
    482  1.1  christos     Status = AcpiNsOneCompleteParse (ACPI_IMODE_LOAD_PASS2, TableIndex, NULL);
    483  1.1  christos     if (ACPI_FAILURE (Status))
    484  1.1  christos     {
    485  1.1  christos         return (Status);
    486  1.1  christos     }
    487  1.1  christos 
    488  1.1  christos     /* No need to parse control methods of external table */
    489  1.1  christos 
    490  1.1  christos     if (External)
    491  1.1  christos     {
    492  1.1  christos         return (AE_OK);
    493  1.1  christos     }
    494  1.1  christos 
    495  1.1  christos     /*
    496  1.1  christos      * Pass 3: Parse control methods and link their parse trees
    497  1.1  christos      * into the main parse tree
    498  1.1  christos      */
    499  1.1  christos     fprintf (stderr,
    500  1.1  christos         "Parsing Deferred Opcodes (Methods/Buffers/Packages/Regions)\n");
    501  1.1  christos 
    502  1.3  christos     (void) AcpiDmParseDeferredOps (AcpiGbl_ParseOpRoot);
    503  1.1  christos     fprintf (stderr, "\n");
    504  1.1  christos 
    505  1.1  christos     /* Process Resource Templates */
    506  1.1  christos 
    507  1.1  christos     AcpiDmFindResources (AcpiGbl_ParseOpRoot);
    508  1.1  christos 
    509  1.1  christos     fprintf (stderr, "Parsing completed\n");
    510  1.1  christos     return (AE_OK);
    511  1.1  christos }
    512