Back to home page

LXR

 
 

    


File indexing completed on 2025-05-11 08:24:03

0001 /******************************************************************************
0002  *
0003  * Module Name: tbdata - Table manager data structure functions
0004  *
0005  *****************************************************************************/
0006 
0007 /******************************************************************************
0008  *
0009  * 1. Copyright Notice
0010  *
0011  * Some or all of this work - Copyright (c) 1999 - 2024, Intel Corp.
0012  * All rights reserved.
0013  *
0014  * 2. License
0015  *
0016  * 2.1. This is your license from Intel Corp. under its intellectual property
0017  * rights. You may have additional license terms from the party that provided
0018  * you this software, covering your right to use that party's intellectual
0019  * property rights.
0020  *
0021  * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
0022  * copy of the source code appearing in this file ("Covered Code") an
0023  * irrevocable, perpetual, worldwide license under Intel's copyrights in the
0024  * base code distributed originally by Intel ("Original Intel Code") to copy,
0025  * make derivatives, distribute, use and display any portion of the Covered
0026  * Code in any form, with the right to sublicense such rights; and
0027  *
0028  * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
0029  * license (with the right to sublicense), under only those claims of Intel
0030  * patents that are infringed by the Original Intel Code, to make, use, sell,
0031  * offer to sell, and import the Covered Code and derivative works thereof
0032  * solely to the minimum extent necessary to exercise the above copyright
0033  * license, and in no event shall the patent license extend to any additions
0034  * to or modifications of the Original Intel Code. No other license or right
0035  * is granted directly or by implication, estoppel or otherwise;
0036  *
0037  * The above copyright and patent license is granted only if the following
0038  * conditions are met:
0039  *
0040  * 3. Conditions
0041  *
0042  * 3.1. Redistribution of Source with Rights to Further Distribute Source.
0043  * Redistribution of source code of any substantial portion of the Covered
0044  * Code or modification with rights to further distribute source must include
0045  * the above Copyright Notice, the above License, this list of Conditions,
0046  * and the following Disclaimer and Export Compliance provision. In addition,
0047  * Licensee must cause all Covered Code to which Licensee contributes to
0048  * contain a file documenting the changes Licensee made to create that Covered
0049  * Code and the date of any change. Licensee must include in that file the
0050  * documentation of any changes made by any predecessor Licensee. Licensee
0051  * must include a prominent statement that the modification is derived,
0052  * directly or indirectly, from Original Intel Code.
0053  *
0054  * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
0055  * Redistribution of source code of any substantial portion of the Covered
0056  * Code or modification without rights to further distribute source must
0057  * include the following Disclaimer and Export Compliance provision in the
0058  * documentation and/or other materials provided with distribution. In
0059  * addition, Licensee may not authorize further sublicense of source of any
0060  * portion of the Covered Code, and must include terms to the effect that the
0061  * license from Licensee to its licensee is limited to the intellectual
0062  * property embodied in the software Licensee provides to its licensee, and
0063  * not to intellectual property embodied in modifications its licensee may
0064  * make.
0065  *
0066  * 3.3. Redistribution of Executable. Redistribution in executable form of any
0067  * substantial portion of the Covered Code or modification must reproduce the
0068  * above Copyright Notice, and the following Disclaimer and Export Compliance
0069  * provision in the documentation and/or other materials provided with the
0070  * distribution.
0071  *
0072  * 3.4. Intel retains all right, title, and interest in and to the Original
0073  * Intel Code.
0074  *
0075  * 3.5. Neither the name Intel nor any other trademark owned or controlled by
0076  * Intel shall be used in advertising or otherwise to promote the sale, use or
0077  * other dealings in products derived from or relating to the Covered Code
0078  * without prior written authorization from Intel.
0079  *
0080  * 4. Disclaimer and Export Compliance
0081  *
0082  * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
0083  * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
0084  * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
0085  * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
0086  * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
0087  * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
0088  * PARTICULAR PURPOSE.
0089  *
0090  * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
0091  * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
0092  * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
0093  * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
0094  * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
0095  * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
0096  * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
0097  * LIMITED REMEDY.
0098  *
0099  * 4.3. Licensee shall not export, either directly or indirectly, any of this
0100  * software or system incorporating such software without first obtaining any
0101  * required license or other approval from the U. S. Department of Commerce or
0102  * any other agency or department of the United States Government. In the
0103  * event Licensee exports any such software from the United States or
0104  * re-exports any such software from a foreign destination, Licensee shall
0105  * ensure that the distribution and export/re-export of the software is in
0106  * compliance with all laws, regulations, orders, or other restrictions of the
0107  * U.S. Export Administration Regulations. Licensee agrees that neither it nor
0108  * any of its subsidiaries will export/re-export any technical data, process,
0109  * software, or service, directly or indirectly, to any country for which the
0110  * United States government or any agency thereof requires an export license,
0111  * other governmental approval, or letter of assurance, without first obtaining
0112  * such license, approval or letter.
0113  *
0114  *****************************************************************************
0115  *
0116  * Alternatively, you may choose to be licensed under the terms of the
0117  * following license:
0118  *
0119  * Redistribution and use in source and binary forms, with or without
0120  * modification, are permitted provided that the following conditions
0121  * are met:
0122  * 1. Redistributions of source code must retain the above copyright
0123  *    notice, this list of conditions, and the following disclaimer,
0124  *    without modification.
0125  * 2. Redistributions in binary form must reproduce at minimum a disclaimer
0126  *    substantially similar to the "NO WARRANTY" disclaimer below
0127  *    ("Disclaimer") and any redistribution must be conditioned upon
0128  *    including a substantially similar Disclaimer requirement for further
0129  *    binary redistribution.
0130  * 3. Neither the names of the above-listed copyright holders nor the names
0131  *    of any contributors may be used to endorse or promote products derived
0132  *    from this software without specific prior written permission.
0133  *
0134  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
0135  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
0136  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
0137  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
0138  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
0139  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
0140  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
0141  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
0142  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
0143  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
0144  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
0145  *
0146  * Alternatively, you may choose to be licensed under the terms of the
0147  * GNU General Public License ("GPL") version 2 as published by the Free
0148  * Software Foundation.
0149  *
0150  *****************************************************************************/
0151 
0152 #include "acpi.h"
0153 #include "accommon.h"
0154 #include "acnamesp.h"
0155 #include "actables.h"
0156 #include "acevents.h"
0157 
0158 #define _COMPONENT          ACPI_TABLES
0159         ACPI_MODULE_NAME    ("tbdata")
0160 
0161 /* Local prototypes */
0162 
0163 static ACPI_STATUS
0164 AcpiTbCheckDuplication (
0165     ACPI_TABLE_DESC         *TableDesc,
0166     UINT32                  *TableIndex);
0167 
0168 static BOOLEAN
0169 AcpiTbCompareTables (
0170     ACPI_TABLE_DESC         *TableDesc,
0171     UINT32                  TableIndex);
0172 
0173 
0174 /*******************************************************************************
0175  *
0176  * FUNCTION:    AcpiTbCompareTables
0177  *
0178  * PARAMETERS:  TableDesc           - Table 1 descriptor to be compared
0179  *              TableIndex          - Index of table 2 to be compared
0180  *
0181  * RETURN:      TRUE if both tables are identical.
0182  *
0183  * DESCRIPTION: This function compares a table with another table that has
0184  *              already been installed in the root table list.
0185  *
0186  ******************************************************************************/
0187 
0188 static BOOLEAN
0189 AcpiTbCompareTables (
0190     ACPI_TABLE_DESC         *TableDesc,
0191     UINT32                  TableIndex)
0192 {
0193     ACPI_STATUS             Status = AE_OK;
0194     BOOLEAN                 IsIdentical;
0195     ACPI_TABLE_HEADER       *Table;
0196     UINT32                  TableLength;
0197     UINT8                   TableFlags;
0198 
0199 
0200     Status = AcpiTbAcquireTable (&AcpiGbl_RootTableList.Tables[TableIndex],
0201         &Table, &TableLength, &TableFlags);
0202     if (ACPI_FAILURE (Status))
0203     {
0204         return (FALSE);
0205     }
0206 
0207     /*
0208      * Check for a table match on the entire table length,
0209      * not just the header.
0210      */
0211     IsIdentical = (BOOLEAN)((TableDesc->Length != TableLength ||
0212         memcmp (TableDesc->Pointer, Table, TableLength)) ?
0213         FALSE : TRUE);
0214 
0215     /* Release the acquired table */
0216 
0217     AcpiTbReleaseTable (Table, TableLength, TableFlags);
0218     return (IsIdentical);
0219 }
0220 
0221 
0222 /*******************************************************************************
0223  *
0224  * FUNCTION:    AcpiTbInitTableDescriptor
0225  *
0226  * PARAMETERS:  TableDesc               - Table descriptor
0227  *              Address                 - Physical address of the table
0228  *              Flags                   - Allocation flags of the table
0229  *              Table                   - Pointer to the table
0230  *
0231  * RETURN:      None
0232  *
0233  * DESCRIPTION: Initialize a new table descriptor
0234  *
0235  ******************************************************************************/
0236 
0237 void
0238 AcpiTbInitTableDescriptor (
0239     ACPI_TABLE_DESC         *TableDesc,
0240     ACPI_PHYSICAL_ADDRESS   Address,
0241     UINT8                   Flags,
0242     ACPI_TABLE_HEADER       *Table)
0243 {
0244 
0245     /*
0246      * Initialize the table descriptor. Set the pointer to NULL for external
0247      * tables, since the table is not fully mapped at this time.
0248      */
0249     memset (TableDesc, 0, sizeof (ACPI_TABLE_DESC));
0250     TableDesc->Address = Address;
0251     TableDesc->Length = Table->Length;
0252     TableDesc->Flags = Flags;
0253     ACPI_MOVE_32_TO_32 (TableDesc->Signature.Ascii, Table->Signature);
0254 
0255     switch (TableDesc->Flags & ACPI_TABLE_ORIGIN_MASK)
0256     {
0257     case ACPI_TABLE_ORIGIN_INTERNAL_VIRTUAL:
0258     case ACPI_TABLE_ORIGIN_EXTERNAL_VIRTUAL:
0259 
0260         TableDesc->Pointer = Table;
0261         break;
0262 
0263     case ACPI_TABLE_ORIGIN_INTERNAL_PHYSICAL:
0264     default:
0265 
0266         break;
0267     }
0268 }
0269 
0270 
0271 /*******************************************************************************
0272  *
0273  * FUNCTION:    AcpiTbAcquireTable
0274  *
0275  * PARAMETERS:  TableDesc           - Table descriptor
0276  *              TablePtr            - Where table is returned
0277  *              TableLength         - Where table length is returned
0278  *              TableFlags          - Where table allocation flags are returned
0279  *
0280  * RETURN:      Status
0281  *
0282  * DESCRIPTION: Acquire an ACPI table. It can be used for tables not
0283  *              maintained in the AcpiGbl_RootTableList.
0284  *
0285  ******************************************************************************/
0286 
0287 ACPI_STATUS
0288 AcpiTbAcquireTable (
0289     ACPI_TABLE_DESC         *TableDesc,
0290     ACPI_TABLE_HEADER       **TablePtr,
0291     UINT32                  *TableLength,
0292     UINT8                   *TableFlags)
0293 {
0294     ACPI_TABLE_HEADER       *Table = NULL;
0295 
0296 
0297     switch (TableDesc->Flags & ACPI_TABLE_ORIGIN_MASK)
0298     {
0299     case ACPI_TABLE_ORIGIN_INTERNAL_PHYSICAL:
0300 
0301         Table = AcpiOsMapMemory (TableDesc->Address, TableDesc->Length);
0302         break;
0303 
0304     case ACPI_TABLE_ORIGIN_INTERNAL_VIRTUAL:
0305     case ACPI_TABLE_ORIGIN_EXTERNAL_VIRTUAL:
0306 
0307         Table = TableDesc->Pointer;
0308         break;
0309 
0310     default:
0311 
0312         break;
0313     }
0314 
0315     /* Table is not valid yet */
0316 
0317     if (!Table)
0318     {
0319         return (AE_NO_MEMORY);
0320     }
0321 
0322     /* Fill the return values */
0323 
0324     *TablePtr = Table;
0325     *TableLength = TableDesc->Length;
0326     *TableFlags = TableDesc->Flags;
0327     return (AE_OK);
0328 }
0329 
0330 
0331 /*******************************************************************************
0332  *
0333  * FUNCTION:    AcpiTbReleaseTable
0334  *
0335  * PARAMETERS:  Table               - Pointer for the table
0336  *              TableLength         - Length for the table
0337  *              TableFlags          - Allocation flags for the table
0338  *
0339  * RETURN:      None
0340  *
0341  * DESCRIPTION: Release a table. The inverse of AcpiTbAcquireTable().
0342  *
0343  ******************************************************************************/
0344 
0345 void
0346 AcpiTbReleaseTable (
0347     ACPI_TABLE_HEADER       *Table,
0348     UINT32                  TableLength,
0349     UINT8                   TableFlags)
0350 {
0351 
0352     switch (TableFlags & ACPI_TABLE_ORIGIN_MASK)
0353     {
0354     case ACPI_TABLE_ORIGIN_INTERNAL_PHYSICAL:
0355 
0356         AcpiOsUnmapMemory (Table, TableLength);
0357         break;
0358 
0359     case ACPI_TABLE_ORIGIN_INTERNAL_VIRTUAL:
0360     case ACPI_TABLE_ORIGIN_EXTERNAL_VIRTUAL:
0361     default:
0362 
0363         break;
0364     }
0365 }
0366 
0367 
0368 /*******************************************************************************
0369  *
0370  * FUNCTION:    AcpiTbAcquireTempTable
0371  *
0372  * PARAMETERS:  TableDesc           - Table descriptor to be acquired
0373  *              Address             - Address of the table
0374  *              Flags               - Allocation flags of the table
0375  *              Table               - Pointer to the table (required for virtual
0376  *                                    origins, optional for physical)
0377  *
0378  * RETURN:      Status
0379  *
0380  * DESCRIPTION: This function validates the table header to obtain the length
0381  *              of a table and fills the table descriptor to make its state as
0382  *              "INSTALLED". Such a table descriptor is only used for verified
0383  *              installation.
0384  *
0385  ******************************************************************************/
0386 
0387 ACPI_STATUS
0388 AcpiTbAcquireTempTable (
0389     ACPI_TABLE_DESC         *TableDesc,
0390     ACPI_PHYSICAL_ADDRESS   Address,
0391     UINT8                   Flags,
0392     ACPI_TABLE_HEADER       *Table)
0393 {
0394     BOOLEAN                 MappedTable = FALSE;
0395 
0396 
0397     switch (Flags & ACPI_TABLE_ORIGIN_MASK)
0398     {
0399     case ACPI_TABLE_ORIGIN_INTERNAL_PHYSICAL:
0400 
0401         /* Get the length of the full table from the header */
0402 
0403         if (!Table)
0404         {
0405             Table = AcpiOsMapMemory (Address, sizeof (ACPI_TABLE_HEADER));
0406             if (!Table)
0407             {
0408                 return (AE_NO_MEMORY);
0409             }
0410 
0411             MappedTable = TRUE;
0412         }
0413 
0414         break;
0415 
0416     case ACPI_TABLE_ORIGIN_INTERNAL_VIRTUAL:
0417     case ACPI_TABLE_ORIGIN_EXTERNAL_VIRTUAL:
0418 
0419         if (!Table)
0420         {
0421             return (AE_BAD_PARAMETER);
0422         }
0423 
0424         break;
0425 
0426     default:
0427 
0428         /* Table is not valid yet */
0429 
0430         return (AE_NO_MEMORY);
0431     }
0432 
0433     AcpiTbInitTableDescriptor (TableDesc, Address, Flags, Table);
0434     if (MappedTable)
0435     {
0436         AcpiOsUnmapMemory (Table, sizeof (ACPI_TABLE_HEADER));
0437     }
0438 
0439     return (AE_OK);
0440 }
0441 
0442 
0443 /*******************************************************************************
0444  *
0445  * FUNCTION:    AcpiTbReleaseTempTable
0446  *
0447  * PARAMETERS:  TableDesc           - Table descriptor to be released
0448  *
0449  * RETURN:      Status
0450  *
0451  * DESCRIPTION: The inverse of AcpiTbAcquireTempTable().
0452  *
0453  *****************************************************************************/
0454 
0455 void
0456 AcpiTbReleaseTempTable (
0457     ACPI_TABLE_DESC         *TableDesc)
0458 {
0459 
0460     /*
0461      * Note that the .Address is maintained by the callers of
0462      * AcpiTbAcquireTempTable(), thus do not invoke AcpiTbUninstallTable()
0463      * where .Address will be freed.
0464      */
0465     AcpiTbInvalidateTable (TableDesc);
0466 }
0467 
0468 
0469 /******************************************************************************
0470  *
0471  * FUNCTION:    AcpiTbValidateTable
0472  *
0473  * PARAMETERS:  TableDesc           - Table descriptor
0474  *
0475  * RETURN:      Status
0476  *
0477  * DESCRIPTION: This function is called to validate the table, the returned
0478  *              table descriptor is in "VALIDATED" state.
0479  *
0480  *****************************************************************************/
0481 
0482 ACPI_STATUS
0483 AcpiTbValidateTable (
0484     ACPI_TABLE_DESC         *TableDesc)
0485 {
0486     ACPI_STATUS             Status = AE_OK;
0487 
0488 
0489     ACPI_FUNCTION_TRACE (TbValidateTable);
0490 
0491 
0492     /* Validate the table if necessary */
0493 
0494     if (!TableDesc->Pointer)
0495     {
0496         Status = AcpiTbAcquireTable (TableDesc, &TableDesc->Pointer,
0497             &TableDesc->Length, &TableDesc->Flags);
0498         if (!TableDesc->Pointer)
0499         {
0500             Status = AE_NO_MEMORY;
0501         }
0502     }
0503 
0504     return_ACPI_STATUS (Status);
0505 }
0506 
0507 
0508 /*******************************************************************************
0509  *
0510  * FUNCTION:    AcpiTbInvalidateTable
0511  *
0512  * PARAMETERS:  TableDesc           - Table descriptor
0513  *
0514  * RETURN:      None
0515  *
0516  * DESCRIPTION: Invalidate one internal ACPI table, this is the inverse of
0517  *              AcpiTbValidateTable().
0518  *
0519  ******************************************************************************/
0520 
0521 void
0522 AcpiTbInvalidateTable (
0523     ACPI_TABLE_DESC         *TableDesc)
0524 {
0525 
0526     ACPI_FUNCTION_TRACE (TbInvalidateTable);
0527 
0528 
0529     /* Table must be validated */
0530 
0531     if (!TableDesc->Pointer)
0532     {
0533         return_VOID;
0534     }
0535 
0536     AcpiTbReleaseTable (TableDesc->Pointer, TableDesc->Length,
0537         TableDesc->Flags);
0538 
0539     switch (TableDesc->Flags & ACPI_TABLE_ORIGIN_MASK)
0540     {
0541     case ACPI_TABLE_ORIGIN_INTERNAL_PHYSICAL:
0542 
0543         TableDesc->Pointer = NULL;
0544         break;
0545 
0546     case ACPI_TABLE_ORIGIN_INTERNAL_VIRTUAL:
0547     case ACPI_TABLE_ORIGIN_EXTERNAL_VIRTUAL:
0548     default:
0549 
0550         break;
0551     }
0552 
0553     return_VOID;
0554 }
0555 
0556 
0557 /******************************************************************************
0558  *
0559  * FUNCTION:    AcpiTbValidateTempTable
0560  *
0561  * PARAMETERS:  TableDesc           - Table descriptor
0562  *
0563  * RETURN:      Status
0564  *
0565  * DESCRIPTION: This function is called to validate the table, the returned
0566  *              table descriptor is in "VALIDATED" state.
0567  *
0568  *****************************************************************************/
0569 
0570 ACPI_STATUS
0571 AcpiTbValidateTempTable (
0572     ACPI_TABLE_DESC         *TableDesc)
0573 {
0574 
0575     if (!TableDesc->Pointer && !AcpiGbl_EnableTableValidation)
0576     {
0577         /*
0578          * Only validates the header of the table.
0579          * Note that Length contains the size of the mapping after invoking
0580          * this work around, this value is required by
0581          * AcpiTbReleaseTempTable().
0582          * We can do this because in AcpiInitTableDescriptor(), the Length
0583          * field of the installed descriptor is filled with the actual
0584          * table length obtaining from the table header.
0585          */
0586         TableDesc->Length = sizeof (ACPI_TABLE_HEADER);
0587     }
0588 
0589     return (AcpiTbValidateTable (TableDesc));
0590 }
0591 
0592 
0593 /*******************************************************************************
0594  *
0595  * FUNCTION:    AcpiTbCheckDuplication
0596  *
0597  * PARAMETERS:  TableDesc           - Table descriptor
0598  *              TableIndex          - Where the table index is returned
0599  *
0600  * RETURN:      Status
0601  *
0602  * DESCRIPTION: Avoid installing duplicated tables. However table override and
0603  *              user aided dynamic table load is allowed, thus comparing the
0604  *              address of the table is not sufficient, and checking the entire
0605  *              table content is required.
0606  *
0607  ******************************************************************************/
0608 
0609 static ACPI_STATUS
0610 AcpiTbCheckDuplication (
0611     ACPI_TABLE_DESC         *TableDesc,
0612     UINT32                  *TableIndex)
0613 {
0614     UINT32                  i;
0615 
0616 
0617     ACPI_FUNCTION_TRACE (TbCheckDuplication);
0618 
0619 
0620     /* Check if table is already registered */
0621 
0622     for (i = 0; i < AcpiGbl_RootTableList.CurrentTableCount; ++i)
0623     {
0624         /* Do not compare with unverified tables */
0625 
0626         if (!(AcpiGbl_RootTableList.Tables[i].Flags & ACPI_TABLE_IS_VERIFIED))
0627         {
0628             continue;
0629         }
0630 
0631         /*
0632          * Check for a table match on the entire table length,
0633          * not just the header.
0634          */
0635         if (!AcpiTbCompareTables (TableDesc, i))
0636         {
0637             continue;
0638         }
0639 
0640         /*
0641          * Note: the current mechanism does not unregister a table if it is
0642          * dynamically unloaded. The related namespace entries are deleted,
0643          * but the table remains in the root table list.
0644          *
0645          * The assumption here is that the number of different tables that
0646          * will be loaded is actually small, and there is minimal overhead
0647          * in just keeping the table in case it is needed again.
0648          *
0649          * If this assumption changes in the future (perhaps on large
0650          * machines with many table load/unload operations), tables will
0651          * need to be unregistered when they are unloaded, and slots in the
0652          * root table list should be reused when empty.
0653          */
0654         if (AcpiGbl_RootTableList.Tables[i].Flags &
0655             ACPI_TABLE_IS_LOADED)
0656         {
0657             /* Table is still loaded, this is an error */
0658 
0659             return_ACPI_STATUS (AE_ALREADY_EXISTS);
0660         }
0661         else
0662         {
0663             *TableIndex = i;
0664             return_ACPI_STATUS (AE_CTRL_TERMINATE);
0665         }
0666     }
0667 
0668     /* Indicate no duplication to the caller */
0669 
0670     return_ACPI_STATUS (AE_OK);
0671 }
0672 
0673 
0674 /******************************************************************************
0675  *
0676  * FUNCTION:    AcpiTbVerifyTempTable
0677  *
0678  * PARAMETERS:  TableDesc           - Table descriptor
0679  *              Signature           - Table signature to verify
0680  *              TableIndex          - Where the table index is returned
0681  *
0682  * RETURN:      Status
0683  *
0684  * DESCRIPTION: This function is called to validate and verify the table, the
0685  *              returned table descriptor is in "VALIDATED" state.
0686  *              Note that 'TableIndex' is required to be set to !NULL to
0687  *              enable duplication check.
0688  *
0689  *****************************************************************************/
0690 
0691 ACPI_STATUS
0692 AcpiTbVerifyTempTable (
0693     ACPI_TABLE_DESC         *TableDesc,
0694     char                    *Signature,
0695     UINT32                  *TableIndex)
0696 {
0697     ACPI_STATUS             Status = AE_OK;
0698 
0699 
0700     ACPI_FUNCTION_TRACE (TbVerifyTempTable);
0701 
0702 
0703     /* Validate the table */
0704 
0705     Status = AcpiTbValidateTempTable (TableDesc);
0706     if (ACPI_FAILURE (Status))
0707     {
0708         return_ACPI_STATUS (AE_NO_MEMORY);
0709     }
0710 
0711     /* If a particular signature is expected (DSDT/FACS), it must match */
0712 
0713     if (Signature &&
0714         !ACPI_COMPARE_NAMESEG (&TableDesc->Signature, Signature))
0715     {
0716         ACPI_BIOS_ERROR ((AE_INFO,
0717             "Invalid signature 0x%X for ACPI table, expected [%s]",
0718             TableDesc->Signature.Integer, Signature));
0719         Status = AE_BAD_SIGNATURE;
0720         goto InvalidateAndExit;
0721     }
0722 
0723     if (AcpiGbl_EnableTableValidation)
0724     {
0725         /* Verify the checksum */
0726 
0727         Status = AcpiUtVerifyChecksum (TableDesc->Pointer, TableDesc->Length);
0728         if (ACPI_FAILURE (Status))
0729         {
0730             ACPI_EXCEPTION ((AE_INFO, AE_NO_MEMORY,
0731                 "%4.4s 0x%8.8X%8.8X"
0732                 " Attempted table install failed",
0733                 AcpiUtValidNameseg (TableDesc->Signature.Ascii) ?
0734                     TableDesc->Signature.Ascii : "????",
0735                 ACPI_FORMAT_UINT64 (TableDesc->Address)));
0736 
0737             goto InvalidateAndExit;
0738         }
0739 
0740         /* Avoid duplications */
0741 
0742         if (TableIndex)
0743         {
0744             Status = AcpiTbCheckDuplication (TableDesc, TableIndex);
0745             if (ACPI_FAILURE (Status))
0746             {
0747                 if (Status != AE_CTRL_TERMINATE)
0748                 {
0749                     ACPI_EXCEPTION ((AE_INFO, Status,
0750                         "%4.4s 0x%8.8X%8.8X"
0751                         " Table is already loaded",
0752                         AcpiUtValidNameseg (TableDesc->Signature.Ascii) ?
0753                             TableDesc->Signature.Ascii : "????",
0754                         ACPI_FORMAT_UINT64 (TableDesc->Address)));
0755                 }
0756 
0757                 goto InvalidateAndExit;
0758             }
0759         }
0760 
0761         TableDesc->Flags |= ACPI_TABLE_IS_VERIFIED;
0762     }
0763 
0764     return_ACPI_STATUS (Status);
0765 
0766 InvalidateAndExit:
0767     AcpiTbInvalidateTable (TableDesc);
0768     return_ACPI_STATUS (Status);
0769 }
0770 
0771 
0772 /*******************************************************************************
0773  *
0774  * FUNCTION:    AcpiTbResizeRootTableList
0775  *
0776  * PARAMETERS:  None
0777  *
0778  * RETURN:      Status
0779  *
0780  * DESCRIPTION: Expand the size of global table array
0781  *
0782  ******************************************************************************/
0783 
0784 ACPI_STATUS
0785 AcpiTbResizeRootTableList (
0786     void)
0787 {
0788     ACPI_TABLE_DESC         *Tables;
0789     UINT32                  TableCount;
0790     UINT32                  CurrentTableCount, MaxTableCount;
0791     UINT32                  i;
0792 
0793 
0794     ACPI_FUNCTION_TRACE (TbResizeRootTableList);
0795 
0796 
0797     /* AllowResize flag is a parameter to AcpiInitializeTables */
0798 
0799     if (!(AcpiGbl_RootTableList.Flags & ACPI_ROOT_ALLOW_RESIZE))
0800     {
0801         ACPI_ERROR ((AE_INFO, "Resize of Root Table Array is not allowed"));
0802         return_ACPI_STATUS (AE_SUPPORT);
0803     }
0804 
0805     /* Increase the Table Array size */
0806 
0807     if (AcpiGbl_RootTableList.Flags & ACPI_ROOT_ORIGIN_ALLOCATED)
0808     {
0809         TableCount = AcpiGbl_RootTableList.MaxTableCount;
0810     }
0811     else
0812     {
0813         TableCount = AcpiGbl_RootTableList.CurrentTableCount;
0814     }
0815 
0816     MaxTableCount = TableCount + ACPI_ROOT_TABLE_SIZE_INCREMENT;
0817     Tables = ACPI_ALLOCATE_ZEROED (
0818         ((ACPI_SIZE) MaxTableCount) * sizeof (ACPI_TABLE_DESC));
0819     if (!Tables)
0820     {
0821         ACPI_ERROR ((AE_INFO, "Could not allocate new root table array"));
0822         return_ACPI_STATUS (AE_NO_MEMORY);
0823     }
0824 
0825     /* Copy and free the previous table array */
0826 
0827     CurrentTableCount = 0;
0828     if (AcpiGbl_RootTableList.Tables)
0829     {
0830         for (i = 0; i < TableCount; i++)
0831         {
0832             if (AcpiGbl_RootTableList.Tables[i].Address)
0833             {
0834                 memcpy (Tables + CurrentTableCount,
0835                     AcpiGbl_RootTableList.Tables + i,
0836                     sizeof (ACPI_TABLE_DESC));
0837                 CurrentTableCount++;
0838             }
0839         }
0840 
0841         if (AcpiGbl_RootTableList.Flags & ACPI_ROOT_ORIGIN_ALLOCATED)
0842         {
0843             ACPI_FREE (AcpiGbl_RootTableList.Tables);
0844         }
0845     }
0846 
0847     AcpiGbl_RootTableList.Tables = Tables;
0848     AcpiGbl_RootTableList.MaxTableCount = MaxTableCount;
0849     AcpiGbl_RootTableList.CurrentTableCount = CurrentTableCount;
0850     AcpiGbl_RootTableList.Flags |= ACPI_ROOT_ORIGIN_ALLOCATED;
0851 
0852     return_ACPI_STATUS (AE_OK);
0853 }
0854 
0855 
0856 /*******************************************************************************
0857  *
0858  * FUNCTION:    AcpiTbGetNextTableDescriptor
0859  *
0860  * PARAMETERS:  TableIndex          - Where table index is returned
0861  *              TableDesc           - Where table descriptor is returned
0862  *
0863  * RETURN:      Status and table index/descriptor.
0864  *
0865  * DESCRIPTION: Allocate a new ACPI table entry to the global table list
0866  *
0867  ******************************************************************************/
0868 
0869 ACPI_STATUS
0870 AcpiTbGetNextTableDescriptor (
0871     UINT32                  *TableIndex,
0872     ACPI_TABLE_DESC         **TableDesc)
0873 {
0874     ACPI_STATUS             Status;
0875     UINT32                  i;
0876 
0877 
0878     /* Ensure that there is room for the table in the Root Table List */
0879 
0880     if (AcpiGbl_RootTableList.CurrentTableCount >=
0881         AcpiGbl_RootTableList.MaxTableCount)
0882     {
0883         Status = AcpiTbResizeRootTableList();
0884         if (ACPI_FAILURE (Status))
0885         {
0886             return (Status);
0887         }
0888     }
0889 
0890     i = AcpiGbl_RootTableList.CurrentTableCount;
0891     AcpiGbl_RootTableList.CurrentTableCount++;
0892 
0893     if (TableIndex)
0894     {
0895         *TableIndex = i;
0896     }
0897     if (TableDesc)
0898     {
0899         *TableDesc = &AcpiGbl_RootTableList.Tables[i];
0900     }
0901 
0902     return (AE_OK);
0903 }
0904 
0905 
0906 /*******************************************************************************
0907  *
0908  * FUNCTION:    AcpiTbTerminate
0909  *
0910  * PARAMETERS:  None
0911  *
0912  * RETURN:      None
0913  *
0914  * DESCRIPTION: Delete all internal ACPI tables
0915  *
0916  ******************************************************************************/
0917 
0918 void
0919 AcpiTbTerminate (
0920     void)
0921 {
0922     UINT32                  i;
0923 
0924 
0925     ACPI_FUNCTION_TRACE (TbTerminate);
0926 
0927 
0928     (void) AcpiUtAcquireMutex (ACPI_MTX_TABLES);
0929 
0930     /* Delete the individual tables */
0931 
0932     for (i = 0; i < AcpiGbl_RootTableList.CurrentTableCount; i++)
0933     {
0934         AcpiTbUninstallTable (&AcpiGbl_RootTableList.Tables[i]);
0935     }
0936 
0937     /*
0938      * Delete the root table array if allocated locally. Array cannot be
0939      * mapped, so we don't need to check for that flag.
0940      */
0941     if (AcpiGbl_RootTableList.Flags & ACPI_ROOT_ORIGIN_ALLOCATED)
0942     {
0943         ACPI_FREE (AcpiGbl_RootTableList.Tables);
0944     }
0945 
0946     AcpiGbl_RootTableList.Tables = NULL;
0947     AcpiGbl_RootTableList.Flags = 0;
0948     AcpiGbl_RootTableList.CurrentTableCount = 0;
0949 
0950     ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "ACPI Tables freed\n"));
0951 
0952     (void) AcpiUtReleaseMutex (ACPI_MTX_TABLES);
0953     return_VOID;
0954 }
0955 
0956 
0957 /*******************************************************************************
0958  *
0959  * FUNCTION:    AcpiTbDeleteNamespaceByOwner
0960  *
0961  * PARAMETERS:  TableIndex          - Table index
0962  *
0963  * RETURN:      Status
0964  *
0965  * DESCRIPTION: Delete all namespace objects created when this table was loaded.
0966  *
0967  ******************************************************************************/
0968 
0969 ACPI_STATUS
0970 AcpiTbDeleteNamespaceByOwner (
0971     UINT32                  TableIndex)
0972 {
0973     ACPI_OWNER_ID           OwnerId;
0974     ACPI_STATUS             Status;
0975 
0976 
0977     ACPI_FUNCTION_TRACE (TbDeleteNamespaceByOwner);
0978 
0979 
0980     Status = AcpiUtAcquireMutex (ACPI_MTX_TABLES);
0981     if (ACPI_FAILURE (Status))
0982     {
0983         return_ACPI_STATUS (Status);
0984     }
0985 
0986     if (TableIndex >= AcpiGbl_RootTableList.CurrentTableCount)
0987     {
0988         /* The table index does not exist */
0989 
0990         (void) AcpiUtReleaseMutex (ACPI_MTX_TABLES);
0991         return_ACPI_STATUS (AE_NOT_EXIST);
0992     }
0993 
0994     /* Get the owner ID for this table, used to delete namespace nodes */
0995 
0996     OwnerId = AcpiGbl_RootTableList.Tables[TableIndex].OwnerId;
0997     (void) AcpiUtReleaseMutex (ACPI_MTX_TABLES);
0998 
0999     /*
1000      * Need to acquire the namespace writer lock to prevent interference
1001      * with any concurrent namespace walks. The interpreter must be
1002      * released during the deletion since the acquisition of the deletion
1003      * lock may block, and also since the execution of a namespace walk
1004      * must be allowed to use the interpreter.
1005      */
1006     Status = AcpiUtAcquireWriteLock (&AcpiGbl_NamespaceRwLock);
1007     if (ACPI_FAILURE (Status))
1008     {
1009         return_ACPI_STATUS (Status);
1010     }
1011 
1012     AcpiNsDeleteNamespaceByOwner (OwnerId);
1013     AcpiUtReleaseWriteLock (&AcpiGbl_NamespaceRwLock);
1014     return_ACPI_STATUS (Status);
1015 }
1016 
1017 
1018 /*******************************************************************************
1019  *
1020  * FUNCTION:    AcpiTbAllocateOwnerId
1021  *
1022  * PARAMETERS:  TableIndex          - Table index
1023  *
1024  * RETURN:      Status
1025  *
1026  * DESCRIPTION: Allocates OwnerId in TableDesc
1027  *
1028  ******************************************************************************/
1029 
1030 ACPI_STATUS
1031 AcpiTbAllocateOwnerId (
1032     UINT32                  TableIndex)
1033 {
1034     ACPI_STATUS             Status = AE_BAD_PARAMETER;
1035 
1036 
1037     ACPI_FUNCTION_TRACE (TbAllocateOwnerId);
1038 
1039 
1040     (void) AcpiUtAcquireMutex (ACPI_MTX_TABLES);
1041     if (TableIndex < AcpiGbl_RootTableList.CurrentTableCount)
1042     {
1043         Status = AcpiUtAllocateOwnerId (
1044             &(AcpiGbl_RootTableList.Tables[TableIndex].OwnerId));
1045     }
1046 
1047     (void) AcpiUtReleaseMutex (ACPI_MTX_TABLES);
1048     return_ACPI_STATUS (Status);
1049 }
1050 
1051 
1052 /*******************************************************************************
1053  *
1054  * FUNCTION:    AcpiTbReleaseOwnerId
1055  *
1056  * PARAMETERS:  TableIndex          - Table index
1057  *
1058  * RETURN:      Status
1059  *
1060  * DESCRIPTION: Releases OwnerId in TableDesc
1061  *
1062  ******************************************************************************/
1063 
1064 ACPI_STATUS
1065 AcpiTbReleaseOwnerId (
1066     UINT32                  TableIndex)
1067 {
1068     ACPI_STATUS             Status = AE_BAD_PARAMETER;
1069 
1070 
1071     ACPI_FUNCTION_TRACE (TbReleaseOwnerId);
1072 
1073 
1074     (void) AcpiUtAcquireMutex (ACPI_MTX_TABLES);
1075     if (TableIndex < AcpiGbl_RootTableList.CurrentTableCount)
1076     {
1077         AcpiUtReleaseOwnerId (
1078             &(AcpiGbl_RootTableList.Tables[TableIndex].OwnerId));
1079         Status = AE_OK;
1080     }
1081 
1082     (void) AcpiUtReleaseMutex (ACPI_MTX_TABLES);
1083     return_ACPI_STATUS (Status);
1084 }
1085 
1086 
1087 /*******************************************************************************
1088  *
1089  * FUNCTION:    AcpiTbGetOwnerId
1090  *
1091  * PARAMETERS:  TableIndex          - Table index
1092  *              OwnerId             - Where the table OwnerId is returned
1093  *
1094  * RETURN:      Status
1095  *
1096  * DESCRIPTION: returns OwnerId for the ACPI table
1097  *
1098  ******************************************************************************/
1099 
1100 ACPI_STATUS
1101 AcpiTbGetOwnerId (
1102     UINT32                  TableIndex,
1103     ACPI_OWNER_ID           *OwnerId)
1104 {
1105     ACPI_STATUS             Status = AE_BAD_PARAMETER;
1106 
1107 
1108     ACPI_FUNCTION_TRACE (TbGetOwnerId);
1109 
1110 
1111     (void) AcpiUtAcquireMutex (ACPI_MTX_TABLES);
1112     if (TableIndex < AcpiGbl_RootTableList.CurrentTableCount)
1113     {
1114         *OwnerId = AcpiGbl_RootTableList.Tables[TableIndex].OwnerId;
1115         Status = AE_OK;
1116     }
1117 
1118     (void) AcpiUtReleaseMutex (ACPI_MTX_TABLES);
1119     return_ACPI_STATUS (Status);
1120 }
1121 
1122 
1123 /*******************************************************************************
1124  *
1125  * FUNCTION:    AcpiTbIsTableLoaded
1126  *
1127  * PARAMETERS:  TableIndex          - Index into the root table
1128  *
1129  * RETURN:      Table Loaded Flag
1130  *
1131  ******************************************************************************/
1132 
1133 BOOLEAN
1134 AcpiTbIsTableLoaded (
1135     UINT32                  TableIndex)
1136 {
1137     BOOLEAN                 IsLoaded = FALSE;
1138 
1139 
1140     (void) AcpiUtAcquireMutex (ACPI_MTX_TABLES);
1141     if (TableIndex < AcpiGbl_RootTableList.CurrentTableCount)
1142     {
1143         IsLoaded = (BOOLEAN)
1144             (AcpiGbl_RootTableList.Tables[TableIndex].Flags &
1145             ACPI_TABLE_IS_LOADED);
1146     }
1147 
1148     (void) AcpiUtReleaseMutex (ACPI_MTX_TABLES);
1149     return (IsLoaded);
1150 }
1151 
1152 
1153 /*******************************************************************************
1154  *
1155  * FUNCTION:    AcpiTbSetTableLoadedFlag
1156  *
1157  * PARAMETERS:  TableIndex          - Table index
1158  *              IsLoaded            - TRUE if table is loaded, FALSE otherwise
1159  *
1160  * RETURN:      None
1161  *
1162  * DESCRIPTION: Sets the table loaded flag to either TRUE or FALSE.
1163  *
1164  ******************************************************************************/
1165 
1166 void
1167 AcpiTbSetTableLoadedFlag (
1168     UINT32                  TableIndex,
1169     BOOLEAN                 IsLoaded)
1170 {
1171 
1172     (void) AcpiUtAcquireMutex (ACPI_MTX_TABLES);
1173     if (TableIndex < AcpiGbl_RootTableList.CurrentTableCount)
1174     {
1175         if (IsLoaded)
1176         {
1177             AcpiGbl_RootTableList.Tables[TableIndex].Flags |=
1178                 ACPI_TABLE_IS_LOADED;
1179         }
1180         else
1181         {
1182             AcpiGbl_RootTableList.Tables[TableIndex].Flags &=
1183                 ~ACPI_TABLE_IS_LOADED;
1184         }
1185     }
1186 
1187     (void) AcpiUtReleaseMutex (ACPI_MTX_TABLES);
1188 }
1189 
1190 
1191 /*******************************************************************************
1192  *
1193  * FUNCTION:    AcpiTbLoadTable
1194  *
1195  * PARAMETERS:  TableIndex              - Table index
1196  *              ParentNode              - Where table index is returned
1197  *
1198  * RETURN:      Status
1199  *
1200  * DESCRIPTION: Load an ACPI table
1201  *
1202  ******************************************************************************/
1203 
1204 ACPI_STATUS
1205 AcpiTbLoadTable (
1206     UINT32                  TableIndex,
1207     ACPI_NAMESPACE_NODE     *ParentNode)
1208 {
1209     ACPI_TABLE_HEADER       *Table;
1210     ACPI_STATUS             Status;
1211     ACPI_OWNER_ID           OwnerId;
1212 
1213 
1214     ACPI_FUNCTION_TRACE (TbLoadTable);
1215 
1216 
1217     /*
1218      * Note: Now table is "INSTALLED", it must be validated before
1219      * using.
1220      */
1221     Status = AcpiGetTableByIndex (TableIndex, &Table);
1222     if (ACPI_FAILURE (Status))
1223     {
1224         return_ACPI_STATUS (Status);
1225     }
1226 
1227     Status = AcpiNsLoadTable (TableIndex, ParentNode);
1228     if (ACPI_FAILURE (Status))
1229     {
1230         return_ACPI_STATUS (Status);
1231     }
1232 
1233     /*
1234      * Update GPEs for any new _Lxx/_Exx methods. Ignore errors. The host is
1235      * responsible for discovering any new wake GPEs by running _PRW methods
1236      * that may have been loaded by this table.
1237      */
1238     Status = AcpiTbGetOwnerId (TableIndex, &OwnerId);
1239     if (ACPI_SUCCESS (Status))
1240     {
1241         AcpiEvUpdateGpes (OwnerId);
1242     }
1243 
1244     /* Invoke table handler */
1245 
1246     AcpiTbNotifyTable (ACPI_TABLE_EVENT_LOAD, Table);
1247     return_ACPI_STATUS (Status);
1248 }
1249 
1250 
1251 /*******************************************************************************
1252  *
1253  * FUNCTION:    AcpiTbInstallAndLoadTable
1254  *
1255  * PARAMETERS:  Address                 - Physical address of the table
1256  *              Flags                   - Allocation flags of the table
1257  *              Table                   - Pointer to the table (required for
1258  *                                        virtual origins, optional for
1259  *                                        physical)
1260  *              Override                - Whether override should be performed
1261  *              TableIndex              - Where table index is returned
1262  *
1263  * RETURN:      Status
1264  *
1265  * DESCRIPTION: Install and load an ACPI table
1266  *
1267  ******************************************************************************/
1268 
1269 ACPI_STATUS
1270 AcpiTbInstallAndLoadTable (
1271     ACPI_PHYSICAL_ADDRESS   Address,
1272     UINT8                   Flags,
1273     ACPI_TABLE_HEADER       *Table,
1274     BOOLEAN                 Override,
1275     UINT32                  *TableIndex)
1276 {
1277     ACPI_STATUS             Status;
1278     UINT32                  i;
1279 
1280 
1281     ACPI_FUNCTION_TRACE (TbInstallAndLoadTable);
1282 
1283 
1284     /* Install the table and load it into the namespace */
1285 
1286     Status = AcpiTbInstallStandardTable (Address, Flags, Table, TRUE,
1287         Override, &i);
1288     if (ACPI_FAILURE (Status))
1289     {
1290         goto Exit;
1291     }
1292 
1293     Status = AcpiTbLoadTable (i, AcpiGbl_RootNode);
1294 
1295 Exit:
1296     *TableIndex = i;
1297     return_ACPI_STATUS (Status);
1298 }
1299 
1300 
1301 /*******************************************************************************
1302  *
1303  * FUNCTION:    AcpiTbUnloadTable
1304  *
1305  * PARAMETERS:  TableIndex              - Table index
1306  *
1307  * RETURN:      Status
1308  *
1309  * DESCRIPTION: Unload an ACPI table
1310  *
1311  ******************************************************************************/
1312 
1313 ACPI_STATUS
1314 AcpiTbUnloadTable (
1315     UINT32                  TableIndex)
1316 {
1317     ACPI_STATUS             Status = AE_OK;
1318     ACPI_TABLE_HEADER       *Table;
1319 
1320 
1321     ACPI_FUNCTION_TRACE (TbUnloadTable);
1322 
1323 
1324     /* Ensure the table is still loaded */
1325 
1326     if (!AcpiTbIsTableLoaded (TableIndex))
1327     {
1328         return_ACPI_STATUS (AE_NOT_EXIST);
1329     }
1330 
1331     /* Invoke table handler */
1332 
1333     Status = AcpiGetTableByIndex (TableIndex, &Table);
1334     if (ACPI_SUCCESS (Status))
1335     {
1336         AcpiTbNotifyTable (ACPI_TABLE_EVENT_UNLOAD, Table);
1337     }
1338 
1339     /* Delete the portion of the namespace owned by this table */
1340 
1341     Status = AcpiTbDeleteNamespaceByOwner (TableIndex);
1342     if (ACPI_FAILURE (Status))
1343     {
1344         return_ACPI_STATUS (Status);
1345     }
1346 
1347     (void) AcpiTbReleaseOwnerId (TableIndex);
1348     AcpiTbSetTableLoadedFlag (TableIndex, FALSE);
1349     return_ACPI_STATUS (Status);
1350 }
1351 
1352 
1353 /*******************************************************************************
1354  *
1355  * FUNCTION:    AcpiTbNotifyTable
1356  *
1357  * PARAMETERS:  Event               - Table event
1358  *              Table               - Validated table pointer
1359  *
1360  * RETURN:      None
1361  *
1362  * DESCRIPTION: Notify a table event to the users.
1363  *
1364  ******************************************************************************/
1365 
1366 void
1367 AcpiTbNotifyTable (
1368     UINT32                          Event,
1369     void                            *Table)
1370 {
1371     /* Invoke table handler if present */
1372 
1373     if (AcpiGbl_TableHandler)
1374     {
1375         (void) AcpiGbl_TableHandler (Event, Table,
1376             AcpiGbl_TableHandlerContext);
1377     }
1378 }