Home | History | Annotate | Line # | Download | only in tables
tbutils.c revision 1.1
      1  1.1  jruoho /******************************************************************************
      2  1.1  jruoho  *
      3  1.1  jruoho  * Module Name: tbutils   - table utilities
      4  1.1  jruoho  *
      5  1.1  jruoho  *****************************************************************************/
      6  1.1  jruoho 
      7  1.1  jruoho /******************************************************************************
      8  1.1  jruoho  *
      9  1.1  jruoho  * 1. Copyright Notice
     10  1.1  jruoho  *
     11  1.1  jruoho  * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp.
     12  1.1  jruoho  * All rights reserved.
     13  1.1  jruoho  *
     14  1.1  jruoho  * 2. License
     15  1.1  jruoho  *
     16  1.1  jruoho  * 2.1. This is your license from Intel Corp. under its intellectual property
     17  1.1  jruoho  * rights.  You may have additional license terms from the party that provided
     18  1.1  jruoho  * you this software, covering your right to use that party's intellectual
     19  1.1  jruoho  * property rights.
     20  1.1  jruoho  *
     21  1.1  jruoho  * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
     22  1.1  jruoho  * copy of the source code appearing in this file ("Covered Code") an
     23  1.1  jruoho  * irrevocable, perpetual, worldwide license under Intel's copyrights in the
     24  1.1  jruoho  * base code distributed originally by Intel ("Original Intel Code") to copy,
     25  1.1  jruoho  * make derivatives, distribute, use and display any portion of the Covered
     26  1.1  jruoho  * Code in any form, with the right to sublicense such rights; and
     27  1.1  jruoho  *
     28  1.1  jruoho  * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
     29  1.1  jruoho  * license (with the right to sublicense), under only those claims of Intel
     30  1.1  jruoho  * patents that are infringed by the Original Intel Code, to make, use, sell,
     31  1.1  jruoho  * offer to sell, and import the Covered Code and derivative works thereof
     32  1.1  jruoho  * solely to the minimum extent necessary to exercise the above copyright
     33  1.1  jruoho  * license, and in no event shall the patent license extend to any additions
     34  1.1  jruoho  * to or modifications of the Original Intel Code.  No other license or right
     35  1.1  jruoho  * is granted directly or by implication, estoppel or otherwise;
     36  1.1  jruoho  *
     37  1.1  jruoho  * The above copyright and patent license is granted only if the following
     38  1.1  jruoho  * conditions are met:
     39  1.1  jruoho  *
     40  1.1  jruoho  * 3. Conditions
     41  1.1  jruoho  *
     42  1.1  jruoho  * 3.1. Redistribution of Source with Rights to Further Distribute Source.
     43  1.1  jruoho  * Redistribution of source code of any substantial portion of the Covered
     44  1.1  jruoho  * Code or modification with rights to further distribute source must include
     45  1.1  jruoho  * the above Copyright Notice, the above License, this list of Conditions,
     46  1.1  jruoho  * and the following Disclaimer and Export Compliance provision.  In addition,
     47  1.1  jruoho  * Licensee must cause all Covered Code to which Licensee contributes to
     48  1.1  jruoho  * contain a file documenting the changes Licensee made to create that Covered
     49  1.1  jruoho  * Code and the date of any change.  Licensee must include in that file the
     50  1.1  jruoho  * documentation of any changes made by any predecessor Licensee.  Licensee
     51  1.1  jruoho  * must include a prominent statement that the modification is derived,
     52  1.1  jruoho  * directly or indirectly, from Original Intel Code.
     53  1.1  jruoho  *
     54  1.1  jruoho  * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
     55  1.1  jruoho  * Redistribution of source code of any substantial portion of the Covered
     56  1.1  jruoho  * Code or modification without rights to further distribute source must
     57  1.1  jruoho  * include the following Disclaimer and Export Compliance provision in the
     58  1.1  jruoho  * documentation and/or other materials provided with distribution.  In
     59  1.1  jruoho  * addition, Licensee may not authorize further sublicense of source of any
     60  1.1  jruoho  * portion of the Covered Code, and must include terms to the effect that the
     61  1.1  jruoho  * license from Licensee to its licensee is limited to the intellectual
     62  1.1  jruoho  * property embodied in the software Licensee provides to its licensee, and
     63  1.1  jruoho  * not to intellectual property embodied in modifications its licensee may
     64  1.1  jruoho  * make.
     65  1.1  jruoho  *
     66  1.1  jruoho  * 3.3. Redistribution of Executable. Redistribution in executable form of any
     67  1.1  jruoho  * substantial portion of the Covered Code or modification must reproduce the
     68  1.1  jruoho  * above Copyright Notice, and the following Disclaimer and Export Compliance
     69  1.1  jruoho  * provision in the documentation and/or other materials provided with the
     70  1.1  jruoho  * distribution.
     71  1.1  jruoho  *
     72  1.1  jruoho  * 3.4. Intel retains all right, title, and interest in and to the Original
     73  1.1  jruoho  * Intel Code.
     74  1.1  jruoho  *
     75  1.1  jruoho  * 3.5. Neither the name Intel nor any other trademark owned or controlled by
     76  1.1  jruoho  * Intel shall be used in advertising or otherwise to promote the sale, use or
     77  1.1  jruoho  * other dealings in products derived from or relating to the Covered Code
     78  1.1  jruoho  * without prior written authorization from Intel.
     79  1.1  jruoho  *
     80  1.1  jruoho  * 4. Disclaimer and Export Compliance
     81  1.1  jruoho  *
     82  1.1  jruoho  * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
     83  1.1  jruoho  * HERE.  ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
     84  1.1  jruoho  * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT,  ASSISTANCE,
     85  1.1  jruoho  * INSTALLATION, TRAINING OR OTHER SERVICES.  INTEL WILL NOT PROVIDE ANY
     86  1.1  jruoho  * UPDATES, ENHANCEMENTS OR EXTENSIONS.  INTEL SPECIFICALLY DISCLAIMS ANY
     87  1.1  jruoho  * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
     88  1.1  jruoho  * PARTICULAR PURPOSE.
     89  1.1  jruoho  *
     90  1.1  jruoho  * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
     91  1.1  jruoho  * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
     92  1.1  jruoho  * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
     93  1.1  jruoho  * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
     94  1.1  jruoho  * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
     95  1.1  jruoho  * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES.  THESE LIMITATIONS
     96  1.1  jruoho  * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
     97  1.1  jruoho  * LIMITED REMEDY.
     98  1.1  jruoho  *
     99  1.1  jruoho  * 4.3. Licensee shall not export, either directly or indirectly, any of this
    100  1.1  jruoho  * software or system incorporating such software without first obtaining any
    101  1.1  jruoho  * required license or other approval from the U. S. Department of Commerce or
    102  1.1  jruoho  * any other agency or department of the United States Government.  In the
    103  1.1  jruoho  * event Licensee exports any such software from the United States or
    104  1.1  jruoho  * re-exports any such software from a foreign destination, Licensee shall
    105  1.1  jruoho  * ensure that the distribution and export/re-export of the software is in
    106  1.1  jruoho  * compliance with all laws, regulations, orders, or other restrictions of the
    107  1.1  jruoho  * U.S. Export Administration Regulations. Licensee agrees that neither it nor
    108  1.1  jruoho  * any of its subsidiaries will export/re-export any technical data, process,
    109  1.1  jruoho  * software, or service, directly or indirectly, to any country for which the
    110  1.1  jruoho  * United States government or any agency thereof requires an export license,
    111  1.1  jruoho  * other governmental approval, or letter of assurance, without first obtaining
    112  1.1  jruoho  * such license, approval or letter.
    113  1.1  jruoho  *
    114  1.1  jruoho  *****************************************************************************/
    115  1.1  jruoho 
    116  1.1  jruoho #define __TBUTILS_C__
    117  1.1  jruoho 
    118  1.1  jruoho #include "acpi.h"
    119  1.1  jruoho #include "accommon.h"
    120  1.1  jruoho #include "actables.h"
    121  1.1  jruoho 
    122  1.1  jruoho #define _COMPONENT          ACPI_TABLES
    123  1.1  jruoho         ACPI_MODULE_NAME    ("tbutils")
    124  1.1  jruoho 
    125  1.1  jruoho /* Local prototypes */
    126  1.1  jruoho 
    127  1.1  jruoho static void
    128  1.1  jruoho AcpiTbFixString (
    129  1.1  jruoho     char                    *String,
    130  1.1  jruoho     ACPI_SIZE               Length);
    131  1.1  jruoho 
    132  1.1  jruoho static void
    133  1.1  jruoho AcpiTbCleanupTableHeader (
    134  1.1  jruoho     ACPI_TABLE_HEADER       *OutHeader,
    135  1.1  jruoho     ACPI_TABLE_HEADER       *Header);
    136  1.1  jruoho 
    137  1.1  jruoho static ACPI_PHYSICAL_ADDRESS
    138  1.1  jruoho AcpiTbGetRootTableEntry (
    139  1.1  jruoho     UINT8                   *TableEntry,
    140  1.1  jruoho     UINT32                  TableEntrySize);
    141  1.1  jruoho 
    142  1.1  jruoho 
    143  1.1  jruoho /*******************************************************************************
    144  1.1  jruoho  *
    145  1.1  jruoho  * FUNCTION:    AcpiTbInitializeFacs
    146  1.1  jruoho  *
    147  1.1  jruoho  * PARAMETERS:  None
    148  1.1  jruoho  *
    149  1.1  jruoho  * RETURN:      Status
    150  1.1  jruoho  *
    151  1.1  jruoho  * DESCRIPTION: Create a permanent mapping for the FADT and save it in a global
    152  1.1  jruoho  *              for accessing the Global Lock and Firmware Waking Vector
    153  1.1  jruoho  *
    154  1.1  jruoho  ******************************************************************************/
    155  1.1  jruoho 
    156  1.1  jruoho ACPI_STATUS
    157  1.1  jruoho AcpiTbInitializeFacs (
    158  1.1  jruoho     void)
    159  1.1  jruoho {
    160  1.1  jruoho     ACPI_STATUS             Status;
    161  1.1  jruoho 
    162  1.1  jruoho 
    163  1.1  jruoho     Status = AcpiGetTableByIndex (ACPI_TABLE_INDEX_FACS,
    164  1.1  jruoho                 ACPI_CAST_INDIRECT_PTR (ACPI_TABLE_HEADER, &AcpiGbl_FACS));
    165  1.1  jruoho     return (Status);
    166  1.1  jruoho }
    167  1.1  jruoho 
    168  1.1  jruoho 
    169  1.1  jruoho /*******************************************************************************
    170  1.1  jruoho  *
    171  1.1  jruoho  * FUNCTION:    AcpiTbTablesLoaded
    172  1.1  jruoho  *
    173  1.1  jruoho  * PARAMETERS:  None
    174  1.1  jruoho  *
    175  1.1  jruoho  * RETURN:      TRUE if required ACPI tables are loaded
    176  1.1  jruoho  *
    177  1.1  jruoho  * DESCRIPTION: Determine if the minimum required ACPI tables are present
    178  1.1  jruoho  *              (FADT, FACS, DSDT)
    179  1.1  jruoho  *
    180  1.1  jruoho  ******************************************************************************/
    181  1.1  jruoho 
    182  1.1  jruoho BOOLEAN
    183  1.1  jruoho AcpiTbTablesLoaded (
    184  1.1  jruoho     void)
    185  1.1  jruoho {
    186  1.1  jruoho 
    187  1.1  jruoho     if (AcpiGbl_RootTableList.CurrentTableCount >= 3)
    188  1.1  jruoho     {
    189  1.1  jruoho         return (TRUE);
    190  1.1  jruoho     }
    191  1.1  jruoho 
    192  1.1  jruoho     return (FALSE);
    193  1.1  jruoho }
    194  1.1  jruoho 
    195  1.1  jruoho 
    196  1.1  jruoho /*******************************************************************************
    197  1.1  jruoho  *
    198  1.1  jruoho  * FUNCTION:    AcpiTbFixString
    199  1.1  jruoho  *
    200  1.1  jruoho  * PARAMETERS:  String              - String to be repaired
    201  1.1  jruoho  *              Length              - Maximum length
    202  1.1  jruoho  *
    203  1.1  jruoho  * RETURN:      None
    204  1.1  jruoho  *
    205  1.1  jruoho  * DESCRIPTION: Replace every non-printable or non-ascii byte in the string
    206  1.1  jruoho  *              with a question mark '?'.
    207  1.1  jruoho  *
    208  1.1  jruoho  ******************************************************************************/
    209  1.1  jruoho 
    210  1.1  jruoho static void
    211  1.1  jruoho AcpiTbFixString (
    212  1.1  jruoho     char                    *String,
    213  1.1  jruoho     ACPI_SIZE               Length)
    214  1.1  jruoho {
    215  1.1  jruoho 
    216  1.1  jruoho     while (Length && *String)
    217  1.1  jruoho     {
    218  1.1  jruoho         if (!ACPI_IS_PRINT (*String))
    219  1.1  jruoho         {
    220  1.1  jruoho             *String = '?';
    221  1.1  jruoho         }
    222  1.1  jruoho         String++;
    223  1.1  jruoho         Length--;
    224  1.1  jruoho     }
    225  1.1  jruoho }
    226  1.1  jruoho 
    227  1.1  jruoho 
    228  1.1  jruoho /*******************************************************************************
    229  1.1  jruoho  *
    230  1.1  jruoho  * FUNCTION:    AcpiTbCleanupTableHeader
    231  1.1  jruoho  *
    232  1.1  jruoho  * PARAMETERS:  OutHeader           - Where the cleaned header is returned
    233  1.1  jruoho  *              Header              - Input ACPI table header
    234  1.1  jruoho  *
    235  1.1  jruoho  * RETURN:      Returns the cleaned header in OutHeader
    236  1.1  jruoho  *
    237  1.1  jruoho  * DESCRIPTION: Copy the table header and ensure that all "string" fields in
    238  1.1  jruoho  *              the header consist of printable characters.
    239  1.1  jruoho  *
    240  1.1  jruoho  ******************************************************************************/
    241  1.1  jruoho 
    242  1.1  jruoho static void
    243  1.1  jruoho AcpiTbCleanupTableHeader (
    244  1.1  jruoho     ACPI_TABLE_HEADER       *OutHeader,
    245  1.1  jruoho     ACPI_TABLE_HEADER       *Header)
    246  1.1  jruoho {
    247  1.1  jruoho 
    248  1.1  jruoho     ACPI_MEMCPY (OutHeader, Header, sizeof (ACPI_TABLE_HEADER));
    249  1.1  jruoho 
    250  1.1  jruoho     AcpiTbFixString (OutHeader->Signature, ACPI_NAME_SIZE);
    251  1.1  jruoho     AcpiTbFixString (OutHeader->OemId, ACPI_OEM_ID_SIZE);
    252  1.1  jruoho     AcpiTbFixString (OutHeader->OemTableId, ACPI_OEM_TABLE_ID_SIZE);
    253  1.1  jruoho     AcpiTbFixString (OutHeader->AslCompilerId, ACPI_NAME_SIZE);
    254  1.1  jruoho }
    255  1.1  jruoho 
    256  1.1  jruoho 
    257  1.1  jruoho /*******************************************************************************
    258  1.1  jruoho  *
    259  1.1  jruoho  * FUNCTION:    AcpiTbPrintTableHeader
    260  1.1  jruoho  *
    261  1.1  jruoho  * PARAMETERS:  Address             - Table physical address
    262  1.1  jruoho  *              Header              - Table header
    263  1.1  jruoho  *
    264  1.1  jruoho  * RETURN:      None
    265  1.1  jruoho  *
    266  1.1  jruoho  * DESCRIPTION: Print an ACPI table header. Special cases for FACS and RSDP.
    267  1.1  jruoho  *
    268  1.1  jruoho  ******************************************************************************/
    269  1.1  jruoho 
    270  1.1  jruoho void
    271  1.1  jruoho AcpiTbPrintTableHeader (
    272  1.1  jruoho     ACPI_PHYSICAL_ADDRESS   Address,
    273  1.1  jruoho     ACPI_TABLE_HEADER       *Header)
    274  1.1  jruoho {
    275  1.1  jruoho     ACPI_TABLE_HEADER       LocalHeader;
    276  1.1  jruoho 
    277  1.1  jruoho 
    278  1.1  jruoho     /*
    279  1.1  jruoho      * The reason that the Address is cast to a void pointer is so that we
    280  1.1  jruoho      * can use %p which will work properly on both 32-bit and 64-bit hosts.
    281  1.1  jruoho      */
    282  1.1  jruoho     if (ACPI_COMPARE_NAME (Header->Signature, ACPI_SIG_FACS))
    283  1.1  jruoho     {
    284  1.1  jruoho         /* FACS only has signature and length fields */
    285  1.1  jruoho 
    286  1.1  jruoho         ACPI_INFO ((AE_INFO, "%4.4s %p %05X",
    287  1.1  jruoho             Header->Signature, ACPI_CAST_PTR (void, Address),
    288  1.1  jruoho             Header->Length));
    289  1.1  jruoho     }
    290  1.1  jruoho     else if (ACPI_COMPARE_NAME (Header->Signature, ACPI_SIG_RSDP))
    291  1.1  jruoho     {
    292  1.1  jruoho         /* RSDP has no common fields */
    293  1.1  jruoho 
    294  1.1  jruoho         ACPI_MEMCPY (LocalHeader.OemId,
    295  1.1  jruoho             ACPI_CAST_PTR (ACPI_TABLE_RSDP, Header)->OemId, ACPI_OEM_ID_SIZE);
    296  1.1  jruoho         AcpiTbFixString (LocalHeader.OemId, ACPI_OEM_ID_SIZE);
    297  1.1  jruoho 
    298  1.1  jruoho         ACPI_INFO ((AE_INFO, "RSDP %p %05X (v%.2d %6.6s)",
    299  1.1  jruoho             ACPI_CAST_PTR (void, Address),
    300  1.1  jruoho             (ACPI_CAST_PTR (ACPI_TABLE_RSDP, Header)->Revision > 0) ?
    301  1.1  jruoho                 ACPI_CAST_PTR (ACPI_TABLE_RSDP, Header)->Length : 20,
    302  1.1  jruoho             ACPI_CAST_PTR (ACPI_TABLE_RSDP, Header)->Revision,
    303  1.1  jruoho             LocalHeader.OemId));
    304  1.1  jruoho     }
    305  1.1  jruoho     else
    306  1.1  jruoho     {
    307  1.1  jruoho         /* Standard ACPI table with full common header */
    308  1.1  jruoho 
    309  1.1  jruoho         AcpiTbCleanupTableHeader (&LocalHeader, Header);
    310  1.1  jruoho 
    311  1.1  jruoho         ACPI_INFO ((AE_INFO,
    312  1.1  jruoho             "%4.4s %p %05X (v%.2d %6.6s %8.8s %08X %4.4s %08X)",
    313  1.1  jruoho             LocalHeader.Signature, ACPI_CAST_PTR (void, Address),
    314  1.1  jruoho             LocalHeader.Length, LocalHeader.Revision, LocalHeader.OemId,
    315  1.1  jruoho             LocalHeader.OemTableId, LocalHeader.OemRevision,
    316  1.1  jruoho             LocalHeader.AslCompilerId, LocalHeader.AslCompilerRevision));
    317  1.1  jruoho     }
    318  1.1  jruoho }
    319  1.1  jruoho 
    320  1.1  jruoho 
    321  1.1  jruoho /*******************************************************************************
    322  1.1  jruoho  *
    323  1.1  jruoho  * FUNCTION:    AcpiTbValidateChecksum
    324  1.1  jruoho  *
    325  1.1  jruoho  * PARAMETERS:  Table               - ACPI table to verify
    326  1.1  jruoho  *              Length              - Length of entire table
    327  1.1  jruoho  *
    328  1.1  jruoho  * RETURN:      Status
    329  1.1  jruoho  *
    330  1.1  jruoho  * DESCRIPTION: Verifies that the table checksums to zero. Optionally returns
    331  1.1  jruoho  *              exception on bad checksum.
    332  1.1  jruoho  *
    333  1.1  jruoho  ******************************************************************************/
    334  1.1  jruoho 
    335  1.1  jruoho ACPI_STATUS
    336  1.1  jruoho AcpiTbVerifyChecksum (
    337  1.1  jruoho     ACPI_TABLE_HEADER       *Table,
    338  1.1  jruoho     UINT32                  Length)
    339  1.1  jruoho {
    340  1.1  jruoho     UINT8                   Checksum;
    341  1.1  jruoho 
    342  1.1  jruoho 
    343  1.1  jruoho     /* Compute the checksum on the table */
    344  1.1  jruoho 
    345  1.1  jruoho     Checksum = AcpiTbChecksum (ACPI_CAST_PTR (UINT8, Table), Length);
    346  1.1  jruoho 
    347  1.1  jruoho     /* Checksum ok? (should be zero) */
    348  1.1  jruoho 
    349  1.1  jruoho     if (Checksum)
    350  1.1  jruoho     {
    351  1.1  jruoho         ACPI_WARNING ((AE_INFO,
    352  1.1  jruoho             "Incorrect checksum in table [%4.4s] - 0x%2.2X, should be 0x%2.2X",
    353  1.1  jruoho             Table->Signature, Table->Checksum,
    354  1.1  jruoho             (UINT8) (Table->Checksum - Checksum)));
    355  1.1  jruoho 
    356  1.1  jruoho #if (ACPI_CHECKSUM_ABORT)
    357  1.1  jruoho         return (AE_BAD_CHECKSUM);
    358  1.1  jruoho #endif
    359  1.1  jruoho     }
    360  1.1  jruoho 
    361  1.1  jruoho     return (AE_OK);
    362  1.1  jruoho }
    363  1.1  jruoho 
    364  1.1  jruoho 
    365  1.1  jruoho /*******************************************************************************
    366  1.1  jruoho  *
    367  1.1  jruoho  * FUNCTION:    AcpiTbChecksum
    368  1.1  jruoho  *
    369  1.1  jruoho  * PARAMETERS:  Buffer          - Pointer to memory region to be checked
    370  1.1  jruoho  *              Length          - Length of this memory region
    371  1.1  jruoho  *
    372  1.1  jruoho  * RETURN:      Checksum (UINT8)
    373  1.1  jruoho  *
    374  1.1  jruoho  * DESCRIPTION: Calculates circular checksum of memory region.
    375  1.1  jruoho  *
    376  1.1  jruoho  ******************************************************************************/
    377  1.1  jruoho 
    378  1.1  jruoho UINT8
    379  1.1  jruoho AcpiTbChecksum (
    380  1.1  jruoho     UINT8                   *Buffer,
    381  1.1  jruoho     UINT32                  Length)
    382  1.1  jruoho {
    383  1.1  jruoho     UINT8                   Sum = 0;
    384  1.1  jruoho     UINT8                   *End = Buffer + Length;
    385  1.1  jruoho 
    386  1.1  jruoho 
    387  1.1  jruoho     while (Buffer < End)
    388  1.1  jruoho     {
    389  1.1  jruoho         Sum = (UINT8) (Sum + *(Buffer++));
    390  1.1  jruoho     }
    391  1.1  jruoho 
    392  1.1  jruoho     return Sum;
    393  1.1  jruoho }
    394  1.1  jruoho 
    395  1.1  jruoho 
    396  1.1  jruoho /*******************************************************************************
    397  1.1  jruoho  *
    398  1.1  jruoho  * FUNCTION:    AcpiTbCheckDsdtHeader
    399  1.1  jruoho  *
    400  1.1  jruoho  * PARAMETERS:  None
    401  1.1  jruoho  *
    402  1.1  jruoho  * RETURN:      None
    403  1.1  jruoho  *
    404  1.1  jruoho  * DESCRIPTION: Quick compare to check validity of the DSDT. This will detect
    405  1.1  jruoho  *              if the DSDT has been replaced from outside the OS and/or if
    406  1.1  jruoho  *              the DSDT header has been corrupted.
    407  1.1  jruoho  *
    408  1.1  jruoho  ******************************************************************************/
    409  1.1  jruoho 
    410  1.1  jruoho void
    411  1.1  jruoho AcpiTbCheckDsdtHeader (
    412  1.1  jruoho     void)
    413  1.1  jruoho {
    414  1.1  jruoho 
    415  1.1  jruoho     /* Compare original length and checksum to current values */
    416  1.1  jruoho 
    417  1.1  jruoho     if (AcpiGbl_OriginalDsdtHeader.Length != AcpiGbl_DSDT->Length ||
    418  1.1  jruoho         AcpiGbl_OriginalDsdtHeader.Checksum != AcpiGbl_DSDT->Checksum)
    419  1.1  jruoho     {
    420  1.1  jruoho         ACPI_ERROR ((AE_INFO,
    421  1.1  jruoho             "The DSDT has been corrupted or replaced - old, new headers below"));
    422  1.1  jruoho         AcpiTbPrintTableHeader (0, &AcpiGbl_OriginalDsdtHeader);
    423  1.1  jruoho         AcpiTbPrintTableHeader (0, AcpiGbl_DSDT);
    424  1.1  jruoho 
    425  1.1  jruoho         /* Disable further error messages */
    426  1.1  jruoho 
    427  1.1  jruoho         AcpiGbl_OriginalDsdtHeader.Length = AcpiGbl_DSDT->Length;
    428  1.1  jruoho         AcpiGbl_OriginalDsdtHeader.Checksum = AcpiGbl_DSDT->Checksum;
    429  1.1  jruoho     }
    430  1.1  jruoho }
    431  1.1  jruoho 
    432  1.1  jruoho 
    433  1.1  jruoho /*******************************************************************************
    434  1.1  jruoho  *
    435  1.1  jruoho  * FUNCTION:    AcpiTbCopyDsdt
    436  1.1  jruoho  *
    437  1.1  jruoho  * PARAMETERS:  TableDesc           - Installed table to copy
    438  1.1  jruoho  *
    439  1.1  jruoho  * RETURN:      None
    440  1.1  jruoho  *
    441  1.1  jruoho  * DESCRIPTION: Implements a subsystem option to copy the DSDT to local memory.
    442  1.1  jruoho  *              Some very bad BIOSs are known to either corrupt the DSDT or
    443  1.1  jruoho  *              install a new, bad DSDT. This copy works around the problem.
    444  1.1  jruoho  *
    445  1.1  jruoho  ******************************************************************************/
    446  1.1  jruoho 
    447  1.1  jruoho ACPI_TABLE_HEADER *
    448  1.1  jruoho AcpiTbCopyDsdt (
    449  1.1  jruoho     UINT32                  TableIndex)
    450  1.1  jruoho {
    451  1.1  jruoho     ACPI_TABLE_HEADER       *NewTable;
    452  1.1  jruoho     ACPI_TABLE_DESC         *TableDesc;
    453  1.1  jruoho 
    454  1.1  jruoho 
    455  1.1  jruoho     TableDesc = &AcpiGbl_RootTableList.Tables[TableIndex];
    456  1.1  jruoho 
    457  1.1  jruoho     NewTable = ACPI_ALLOCATE (TableDesc->Length);
    458  1.1  jruoho     if (!NewTable)
    459  1.1  jruoho     {
    460  1.1  jruoho         ACPI_ERROR ((AE_INFO, "Could not copy DSDT of length 0x%X",
    461  1.1  jruoho             TableDesc->Length));
    462  1.1  jruoho         return (NULL);
    463  1.1  jruoho     }
    464  1.1  jruoho 
    465  1.1  jruoho     ACPI_MEMCPY (NewTable, TableDesc->Pointer, TableDesc->Length);
    466  1.1  jruoho     AcpiTbDeleteTable (TableDesc);
    467  1.1  jruoho     TableDesc->Pointer = NewTable;
    468  1.1  jruoho     TableDesc->Flags = ACPI_TABLE_ORIGIN_ALLOCATED;
    469  1.1  jruoho 
    470  1.1  jruoho     ACPI_INFO ((AE_INFO,
    471  1.1  jruoho         "Forced DSDT copy: length 0x%05X copied locally, original unmapped",
    472  1.1  jruoho         NewTable->Length));
    473  1.1  jruoho 
    474  1.1  jruoho     return (NewTable);
    475  1.1  jruoho }
    476  1.1  jruoho 
    477  1.1  jruoho 
    478  1.1  jruoho /*******************************************************************************
    479  1.1  jruoho  *
    480  1.1  jruoho  * FUNCTION:    AcpiTbInstallTable
    481  1.1  jruoho  *
    482  1.1  jruoho  * PARAMETERS:  Address                 - Physical address of DSDT or FACS
    483  1.1  jruoho  *              Signature               - Table signature, NULL if no need to
    484  1.1  jruoho  *                                        match
    485  1.1  jruoho  *              TableIndex              - Index into root table array
    486  1.1  jruoho  *
    487  1.1  jruoho  * RETURN:      None
    488  1.1  jruoho  *
    489  1.1  jruoho  * DESCRIPTION: Install an ACPI table into the global data structure. The
    490  1.1  jruoho  *              table override mechanism is implemented here to allow the host
    491  1.1  jruoho  *              OS to replace any table before it is installed in the root
    492  1.1  jruoho  *              table array.
    493  1.1  jruoho  *
    494  1.1  jruoho  ******************************************************************************/
    495  1.1  jruoho 
    496  1.1  jruoho void
    497  1.1  jruoho AcpiTbInstallTable (
    498  1.1  jruoho     ACPI_PHYSICAL_ADDRESS   Address,
    499  1.1  jruoho     char                    *Signature,
    500  1.1  jruoho     UINT32                  TableIndex)
    501  1.1  jruoho {
    502  1.1  jruoho     UINT8                   Flags;
    503  1.1  jruoho     ACPI_STATUS             Status;
    504  1.1  jruoho     ACPI_TABLE_HEADER       *TableToInstall;
    505  1.1  jruoho     ACPI_TABLE_HEADER       *MappedTable;
    506  1.1  jruoho     ACPI_TABLE_HEADER       *OverrideTable = NULL;
    507  1.1  jruoho 
    508  1.1  jruoho 
    509  1.1  jruoho     if (!Address)
    510  1.1  jruoho     {
    511  1.1  jruoho         ACPI_ERROR ((AE_INFO, "Null physical address for ACPI table [%s]",
    512  1.1  jruoho             Signature));
    513  1.1  jruoho         return;
    514  1.1  jruoho     }
    515  1.1  jruoho 
    516  1.1  jruoho     /* Map just the table header */
    517  1.1  jruoho 
    518  1.1  jruoho     MappedTable = AcpiOsMapMemory (Address, sizeof (ACPI_TABLE_HEADER));
    519  1.1  jruoho     if (!MappedTable)
    520  1.1  jruoho     {
    521  1.1  jruoho         return;
    522  1.1  jruoho     }
    523  1.1  jruoho 
    524  1.1  jruoho     /* If a particular signature is expected (DSDT/FACS), it must match */
    525  1.1  jruoho 
    526  1.1  jruoho     if (Signature &&
    527  1.1  jruoho         !ACPI_COMPARE_NAME (MappedTable->Signature, Signature))
    528  1.1  jruoho     {
    529  1.1  jruoho         ACPI_ERROR ((AE_INFO,
    530  1.1  jruoho             "Invalid signature 0x%X for ACPI table, expected [%s]",
    531  1.1  jruoho             *ACPI_CAST_PTR (UINT32, MappedTable->Signature), Signature));
    532  1.1  jruoho         goto UnmapAndExit;
    533  1.1  jruoho     }
    534  1.1  jruoho 
    535  1.1  jruoho     /*
    536  1.1  jruoho      * ACPI Table Override:
    537  1.1  jruoho      *
    538  1.1  jruoho      * Before we install the table, let the host OS override it with a new
    539  1.1  jruoho      * one if desired. Any table within the RSDT/XSDT can be replaced,
    540  1.1  jruoho      * including the DSDT which is pointed to by the FADT.
    541  1.1  jruoho      */
    542  1.1  jruoho     Status = AcpiOsTableOverride (MappedTable, &OverrideTable);
    543  1.1  jruoho     if (ACPI_SUCCESS (Status) && OverrideTable)
    544  1.1  jruoho     {
    545  1.1  jruoho         ACPI_INFO ((AE_INFO,
    546  1.1  jruoho             "%4.4s @ 0x%p Table override, replaced with:",
    547  1.1  jruoho             MappedTable->Signature, ACPI_CAST_PTR (void, Address)));
    548  1.1  jruoho 
    549  1.1  jruoho         AcpiGbl_RootTableList.Tables[TableIndex].Pointer = OverrideTable;
    550  1.1  jruoho         Address = ACPI_PTR_TO_PHYSADDR (OverrideTable);
    551  1.1  jruoho 
    552  1.1  jruoho         TableToInstall = OverrideTable;
    553  1.1  jruoho         Flags = ACPI_TABLE_ORIGIN_OVERRIDE;
    554  1.1  jruoho     }
    555  1.1  jruoho     else
    556  1.1  jruoho     {
    557  1.1  jruoho         TableToInstall = MappedTable;
    558  1.1  jruoho         Flags = ACPI_TABLE_ORIGIN_MAPPED;
    559  1.1  jruoho     }
    560  1.1  jruoho 
    561  1.1  jruoho     /* Initialize the table entry */
    562  1.1  jruoho 
    563  1.1  jruoho     AcpiGbl_RootTableList.Tables[TableIndex].Address = Address;
    564  1.1  jruoho     AcpiGbl_RootTableList.Tables[TableIndex].Length = TableToInstall->Length;
    565  1.1  jruoho     AcpiGbl_RootTableList.Tables[TableIndex].Flags = Flags;
    566  1.1  jruoho 
    567  1.1  jruoho     ACPI_MOVE_32_TO_32 (
    568  1.1  jruoho         &(AcpiGbl_RootTableList.Tables[TableIndex].Signature),
    569  1.1  jruoho         TableToInstall->Signature);
    570  1.1  jruoho 
    571  1.1  jruoho     AcpiTbPrintTableHeader (Address, TableToInstall);
    572  1.1  jruoho 
    573  1.1  jruoho     if (TableIndex == ACPI_TABLE_INDEX_DSDT)
    574  1.1  jruoho     {
    575  1.1  jruoho         /* Global integer width is based upon revision of the DSDT */
    576  1.1  jruoho 
    577  1.1  jruoho         AcpiUtSetIntegerWidth (TableToInstall->Revision);
    578  1.1  jruoho     }
    579  1.1  jruoho 
    580  1.1  jruoho UnmapAndExit:
    581  1.1  jruoho     AcpiOsUnmapMemory (MappedTable, sizeof (ACPI_TABLE_HEADER));
    582  1.1  jruoho }
    583  1.1  jruoho 
    584  1.1  jruoho 
    585  1.1  jruoho /*******************************************************************************
    586  1.1  jruoho  *
    587  1.1  jruoho  * FUNCTION:    AcpiTbGetRootTableEntry
    588  1.1  jruoho  *
    589  1.1  jruoho  * PARAMETERS:  TableEntry          - Pointer to the RSDT/XSDT table entry
    590  1.1  jruoho  *              TableEntrySize      - sizeof 32 or 64 (RSDT or XSDT)
    591  1.1  jruoho  *
    592  1.1  jruoho  * RETURN:      Physical address extracted from the root table
    593  1.1  jruoho  *
    594  1.1  jruoho  * DESCRIPTION: Get one root table entry. Handles 32-bit and 64-bit cases on
    595  1.1  jruoho  *              both 32-bit and 64-bit platforms
    596  1.1  jruoho  *
    597  1.1  jruoho  * NOTE:        ACPI_PHYSICAL_ADDRESS is 32-bit on 32-bit platforms, 64-bit on
    598  1.1  jruoho  *              64-bit platforms.
    599  1.1  jruoho  *
    600  1.1  jruoho  ******************************************************************************/
    601  1.1  jruoho 
    602  1.1  jruoho static ACPI_PHYSICAL_ADDRESS
    603  1.1  jruoho AcpiTbGetRootTableEntry (
    604  1.1  jruoho     UINT8                   *TableEntry,
    605  1.1  jruoho     UINT32                  TableEntrySize)
    606  1.1  jruoho {
    607  1.1  jruoho     UINT64                  Address64;
    608  1.1  jruoho 
    609  1.1  jruoho 
    610  1.1  jruoho     /*
    611  1.1  jruoho      * Get the table physical address (32-bit for RSDT, 64-bit for XSDT):
    612  1.1  jruoho      * Note: Addresses are 32-bit aligned (not 64) in both RSDT and XSDT
    613  1.1  jruoho      */
    614  1.1  jruoho     if (TableEntrySize == sizeof (UINT32))
    615  1.1  jruoho     {
    616  1.1  jruoho         /*
    617  1.1  jruoho          * 32-bit platform, RSDT: Return 32-bit table entry
    618  1.1  jruoho          * 64-bit platform, RSDT: Expand 32-bit to 64-bit and return
    619  1.1  jruoho          */
    620  1.1  jruoho         return ((ACPI_PHYSICAL_ADDRESS) (*ACPI_CAST_PTR (UINT32, TableEntry)));
    621  1.1  jruoho     }
    622  1.1  jruoho     else
    623  1.1  jruoho     {
    624  1.1  jruoho         /*
    625  1.1  jruoho          * 32-bit platform, XSDT: Truncate 64-bit to 32-bit and return
    626  1.1  jruoho          * 64-bit platform, XSDT: Move (unaligned) 64-bit to local,
    627  1.1  jruoho          *  return 64-bit
    628  1.1  jruoho          */
    629  1.1  jruoho         ACPI_MOVE_64_TO_64 (&Address64, TableEntry);
    630  1.1  jruoho 
    631  1.1  jruoho #if ACPI_MACHINE_WIDTH == 32
    632  1.1  jruoho         if (Address64 > ACPI_UINT32_MAX)
    633  1.1  jruoho         {
    634  1.1  jruoho             /* Will truncate 64-bit address to 32 bits, issue warning */
    635  1.1  jruoho 
    636  1.1  jruoho             ACPI_WARNING ((AE_INFO,
    637  1.1  jruoho                 "64-bit Physical Address in XSDT is too large (0x%8.8X%8.8X),"
    638  1.1  jruoho                 " truncating",
    639  1.1  jruoho                 ACPI_FORMAT_UINT64 (Address64)));
    640  1.1  jruoho         }
    641  1.1  jruoho #endif
    642  1.1  jruoho         return ((ACPI_PHYSICAL_ADDRESS) (Address64));
    643  1.1  jruoho     }
    644  1.1  jruoho }
    645  1.1  jruoho 
    646  1.1  jruoho 
    647  1.1  jruoho /*******************************************************************************
    648  1.1  jruoho  *
    649  1.1  jruoho  * FUNCTION:    AcpiTbParseRootTable
    650  1.1  jruoho  *
    651  1.1  jruoho  * PARAMETERS:  Rsdp                    - Pointer to the RSDP
    652  1.1  jruoho  *
    653  1.1  jruoho  * RETURN:      Status
    654  1.1  jruoho  *
    655  1.1  jruoho  * DESCRIPTION: This function is called to parse the Root System Description
    656  1.1  jruoho  *              Table (RSDT or XSDT)
    657  1.1  jruoho  *
    658  1.1  jruoho  * NOTE:        Tables are mapped (not copied) for efficiency. The FACS must
    659  1.1  jruoho  *              be mapped and cannot be copied because it contains the actual
    660  1.1  jruoho  *              memory location of the ACPI Global Lock.
    661  1.1  jruoho  *
    662  1.1  jruoho  ******************************************************************************/
    663  1.1  jruoho 
    664  1.1  jruoho ACPI_STATUS
    665  1.1  jruoho AcpiTbParseRootTable (
    666  1.1  jruoho     ACPI_PHYSICAL_ADDRESS   RsdpAddress)
    667  1.1  jruoho {
    668  1.1  jruoho     ACPI_TABLE_RSDP         *Rsdp;
    669  1.1  jruoho     UINT32                  TableEntrySize;
    670  1.1  jruoho     UINT32                  i;
    671  1.1  jruoho     UINT32                  TableCount;
    672  1.1  jruoho     ACPI_TABLE_HEADER       *Table;
    673  1.1  jruoho     ACPI_PHYSICAL_ADDRESS   Address;
    674  1.1  jruoho     UINT32                  Length;
    675  1.1  jruoho     UINT8                   *TableEntry;
    676  1.1  jruoho     ACPI_STATUS             Status;
    677  1.1  jruoho 
    678  1.1  jruoho 
    679  1.1  jruoho     ACPI_FUNCTION_TRACE (TbParseRootTable);
    680  1.1  jruoho 
    681  1.1  jruoho 
    682  1.1  jruoho     /*
    683  1.1  jruoho      * Map the entire RSDP and extract the address of the RSDT or XSDT
    684  1.1  jruoho      */
    685  1.1  jruoho     Rsdp = AcpiOsMapMemory (RsdpAddress, sizeof (ACPI_TABLE_RSDP));
    686  1.1  jruoho     if (!Rsdp)
    687  1.1  jruoho     {
    688  1.1  jruoho         return_ACPI_STATUS (AE_NO_MEMORY);
    689  1.1  jruoho     }
    690  1.1  jruoho 
    691  1.1  jruoho     AcpiTbPrintTableHeader (RsdpAddress,
    692  1.1  jruoho         ACPI_CAST_PTR (ACPI_TABLE_HEADER, Rsdp));
    693  1.1  jruoho 
    694  1.1  jruoho     /* Differentiate between RSDT and XSDT root tables */
    695  1.1  jruoho 
    696  1.1  jruoho     if (Rsdp->Revision > 1 && Rsdp->XsdtPhysicalAddress)
    697  1.1  jruoho     {
    698  1.1  jruoho         /*
    699  1.1  jruoho          * Root table is an XSDT (64-bit physical addresses). We must use the
    700  1.1  jruoho          * XSDT if the revision is > 1 and the XSDT pointer is present, as per
    701  1.1  jruoho          * the ACPI specification.
    702  1.1  jruoho          */
    703  1.1  jruoho         Address = (ACPI_PHYSICAL_ADDRESS) Rsdp->XsdtPhysicalAddress;
    704  1.1  jruoho         TableEntrySize = sizeof (UINT64);
    705  1.1  jruoho     }
    706  1.1  jruoho     else
    707  1.1  jruoho     {
    708  1.1  jruoho         /* Root table is an RSDT (32-bit physical addresses) */
    709  1.1  jruoho 
    710  1.1  jruoho         Address = (ACPI_PHYSICAL_ADDRESS) Rsdp->RsdtPhysicalAddress;
    711  1.1  jruoho         TableEntrySize = sizeof (UINT32);
    712  1.1  jruoho     }
    713  1.1  jruoho 
    714  1.1  jruoho     /*
    715  1.1  jruoho      * It is not possible to map more than one entry in some environments,
    716  1.1  jruoho      * so unmap the RSDP here before mapping other tables
    717  1.1  jruoho      */
    718  1.1  jruoho     AcpiOsUnmapMemory (Rsdp, sizeof (ACPI_TABLE_RSDP));
    719  1.1  jruoho 
    720  1.1  jruoho 
    721  1.1  jruoho     /* Map the RSDT/XSDT table header to get the full table length */
    722  1.1  jruoho 
    723  1.1  jruoho     Table = AcpiOsMapMemory (Address, sizeof (ACPI_TABLE_HEADER));
    724  1.1  jruoho     if (!Table)
    725  1.1  jruoho     {
    726  1.1  jruoho         return_ACPI_STATUS (AE_NO_MEMORY);
    727  1.1  jruoho     }
    728  1.1  jruoho 
    729  1.1  jruoho     AcpiTbPrintTableHeader (Address, Table);
    730  1.1  jruoho 
    731  1.1  jruoho     /* Get the length of the full table, verify length and map entire table */
    732  1.1  jruoho 
    733  1.1  jruoho     Length = Table->Length;
    734  1.1  jruoho     AcpiOsUnmapMemory (Table, sizeof (ACPI_TABLE_HEADER));
    735  1.1  jruoho 
    736  1.1  jruoho     if (Length < sizeof (ACPI_TABLE_HEADER))
    737  1.1  jruoho     {
    738  1.1  jruoho         ACPI_ERROR ((AE_INFO, "Invalid length 0x%X in RSDT/XSDT", Length));
    739  1.1  jruoho         return_ACPI_STATUS (AE_INVALID_TABLE_LENGTH);
    740  1.1  jruoho     }
    741  1.1  jruoho 
    742  1.1  jruoho     Table = AcpiOsMapMemory (Address, Length);
    743  1.1  jruoho     if (!Table)
    744  1.1  jruoho     {
    745  1.1  jruoho         return_ACPI_STATUS (AE_NO_MEMORY);
    746  1.1  jruoho     }
    747  1.1  jruoho 
    748  1.1  jruoho     /* Validate the root table checksum */
    749  1.1  jruoho 
    750  1.1  jruoho     Status = AcpiTbVerifyChecksum (Table, Length);
    751  1.1  jruoho     if (ACPI_FAILURE (Status))
    752  1.1  jruoho     {
    753  1.1  jruoho         AcpiOsUnmapMemory (Table, Length);
    754  1.1  jruoho         return_ACPI_STATUS (Status);
    755  1.1  jruoho     }
    756  1.1  jruoho 
    757  1.1  jruoho     /* Calculate the number of tables described in the root table */
    758  1.1  jruoho 
    759  1.1  jruoho     TableCount = (UINT32) ((Table->Length - sizeof (ACPI_TABLE_HEADER)) /
    760  1.1  jruoho         TableEntrySize);
    761  1.1  jruoho 
    762  1.1  jruoho     /*
    763  1.1  jruoho      * First two entries in the table array are reserved for the DSDT
    764  1.1  jruoho      * and FACS, which are not actually present in the RSDT/XSDT - they
    765  1.1  jruoho      * come from the FADT
    766  1.1  jruoho      */
    767  1.1  jruoho     TableEntry = ACPI_CAST_PTR (UINT8, Table) + sizeof (ACPI_TABLE_HEADER);
    768  1.1  jruoho     AcpiGbl_RootTableList.CurrentTableCount = 2;
    769  1.1  jruoho 
    770  1.1  jruoho     /*
    771  1.1  jruoho      * Initialize the root table array from the RSDT/XSDT
    772  1.1  jruoho      */
    773  1.1  jruoho     for (i = 0; i < TableCount; i++)
    774  1.1  jruoho     {
    775  1.1  jruoho         if (AcpiGbl_RootTableList.CurrentTableCount >=
    776  1.1  jruoho             AcpiGbl_RootTableList.MaxTableCount)
    777  1.1  jruoho         {
    778  1.1  jruoho             /* There is no more room in the root table array, attempt resize */
    779  1.1  jruoho 
    780  1.1  jruoho             Status = AcpiTbResizeRootTableList ();
    781  1.1  jruoho             if (ACPI_FAILURE (Status))
    782  1.1  jruoho             {
    783  1.1  jruoho                 ACPI_WARNING ((AE_INFO, "Truncating %u table entries!",
    784  1.1  jruoho                     (unsigned) (TableCount -
    785  1.1  jruoho                     (AcpiGbl_RootTableList.CurrentTableCount - 2))));
    786  1.1  jruoho                 break;
    787  1.1  jruoho             }
    788  1.1  jruoho         }
    789  1.1  jruoho 
    790  1.1  jruoho         /* Get the table physical address (32-bit for RSDT, 64-bit for XSDT) */
    791  1.1  jruoho 
    792  1.1  jruoho         AcpiGbl_RootTableList.Tables[AcpiGbl_RootTableList.CurrentTableCount].Address =
    793  1.1  jruoho             AcpiTbGetRootTableEntry (TableEntry, TableEntrySize);
    794  1.1  jruoho 
    795  1.1  jruoho         TableEntry += TableEntrySize;
    796  1.1  jruoho         AcpiGbl_RootTableList.CurrentTableCount++;
    797  1.1  jruoho     }
    798  1.1  jruoho 
    799  1.1  jruoho     /*
    800  1.1  jruoho      * It is not possible to map more than one entry in some environments,
    801  1.1  jruoho      * so unmap the root table here before mapping other tables
    802  1.1  jruoho      */
    803  1.1  jruoho     AcpiOsUnmapMemory (Table, Length);
    804  1.1  jruoho 
    805  1.1  jruoho     /*
    806  1.1  jruoho      * Complete the initialization of the root table array by examining
    807  1.1  jruoho      * the header of each table
    808  1.1  jruoho      */
    809  1.1  jruoho     for (i = 2; i < AcpiGbl_RootTableList.CurrentTableCount; i++)
    810  1.1  jruoho     {
    811  1.1  jruoho         AcpiTbInstallTable (AcpiGbl_RootTableList.Tables[i].Address,
    812  1.1  jruoho             NULL, i);
    813  1.1  jruoho 
    814  1.1  jruoho         /* Special case for FADT - get the DSDT and FACS */
    815  1.1  jruoho 
    816  1.1  jruoho         if (ACPI_COMPARE_NAME (
    817  1.1  jruoho                 &AcpiGbl_RootTableList.Tables[i].Signature, ACPI_SIG_FADT))
    818  1.1  jruoho         {
    819  1.1  jruoho             AcpiTbParseFadt (i);
    820  1.1  jruoho         }
    821  1.1  jruoho     }
    822  1.1  jruoho 
    823  1.1  jruoho     return_ACPI_STATUS (AE_OK);
    824  1.1  jruoho }
    825