Back to home page

LXR

 
 

    


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

0001 /******************************************************************************
0002  *
0003  * Module Name: tbxfload - Table load/unload external interfaces
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 #define EXPORT_ACPI_INTERFACES
0153 
0154 #include "acpi.h"
0155 #include "accommon.h"
0156 #include "acnamesp.h"
0157 #include "actables.h"
0158 #include "acevents.h"
0159 
0160 #define _COMPONENT          ACPI_TABLES
0161         ACPI_MODULE_NAME    ("tbxfload")
0162 
0163 
0164 /*******************************************************************************
0165  *
0166  * FUNCTION:    AcpiLoadTables
0167  *
0168  * PARAMETERS:  None
0169  *
0170  * RETURN:      Status
0171  *
0172  * DESCRIPTION: Load the ACPI tables from the RSDT/XSDT
0173  *
0174  ******************************************************************************/
0175 
0176 ACPI_STATUS ACPI_INIT_FUNCTION
0177 AcpiLoadTables (
0178     void)
0179 {
0180     ACPI_STATUS             Status;
0181 
0182 
0183     ACPI_FUNCTION_TRACE (AcpiLoadTables);
0184 
0185 
0186     /*
0187      * Install the default operation region handlers. These are the
0188      * handlers that are defined by the ACPI specification to be
0189      * "always accessible" -- namely, SystemMemory, SystemIO, and
0190      * PCI_Config. This also means that no _REG methods need to be
0191      * run for these address spaces. We need to have these handlers
0192      * installed before any AML code can be executed, especially any
0193      * module-level code (11/2015).
0194      * Note that we allow OSPMs to install their own region handlers
0195      * between AcpiInitializeSubsystem() and AcpiLoadTables() to use
0196      * their customized default region handlers.
0197      */
0198     Status = AcpiEvInstallRegionHandlers ();
0199     if (ACPI_FAILURE (Status))
0200     {
0201         ACPI_EXCEPTION ((AE_INFO, Status, "During Region initialization"));
0202         return_ACPI_STATUS (Status);
0203     }
0204 
0205     /* Load the namespace from the tables */
0206 
0207     Status = AcpiTbLoadNamespace ();
0208 
0209     /* Don't let single failures abort the load */
0210 
0211     if (Status == AE_CTRL_TERMINATE)
0212     {
0213         Status = AE_OK;
0214     }
0215 
0216     if (ACPI_FAILURE (Status))
0217     {
0218         ACPI_EXCEPTION ((AE_INFO, Status,
0219             "While loading namespace from ACPI tables"));
0220     }
0221 
0222     /*
0223      * Initialize the objects in the namespace that remain uninitialized.
0224      * This runs the executable AML that may be part of the declaration of
0225      * these name objects:
0226      *     OperationRegions, BufferFields, Buffers, and Packages.
0227      *
0228      */
0229     Status = AcpiNsInitializeObjects ();
0230     if (ACPI_SUCCESS (Status))
0231     {
0232         AcpiGbl_NamespaceInitialized = TRUE;
0233     }
0234 
0235     return_ACPI_STATUS (Status);
0236 }
0237 
0238 ACPI_EXPORT_SYMBOL_INIT (AcpiLoadTables)
0239 
0240 
0241 /*******************************************************************************
0242  *
0243  * FUNCTION:    AcpiTbLoadNamespace
0244  *
0245  * PARAMETERS:  None
0246  *
0247  * RETURN:      Status
0248  *
0249  * DESCRIPTION: Load the namespace from the DSDT and all SSDTs/PSDTs found in
0250  *              the RSDT/XSDT.
0251  *
0252  ******************************************************************************/
0253 
0254 ACPI_STATUS
0255 AcpiTbLoadNamespace (
0256     void)
0257 {
0258     ACPI_STATUS             Status;
0259     UINT32                  i;
0260     ACPI_TABLE_HEADER       *NewDsdt;
0261     ACPI_TABLE_DESC         *Table;
0262     UINT32                  TablesLoaded = 0;
0263     UINT32                  TablesFailed = 0;
0264 
0265 
0266     ACPI_FUNCTION_TRACE (TbLoadNamespace);
0267 
0268 
0269     (void) AcpiUtAcquireMutex (ACPI_MTX_TABLES);
0270 
0271     /*
0272      * Load the namespace. The DSDT is required, but any SSDT and
0273      * PSDT tables are optional. Verify the DSDT.
0274      */
0275     Table = &AcpiGbl_RootTableList.Tables[AcpiGbl_DsdtIndex];
0276 
0277     if (!AcpiGbl_RootTableList.CurrentTableCount ||
0278         !ACPI_COMPARE_NAMESEG (Table->Signature.Ascii, ACPI_SIG_DSDT) ||
0279          ACPI_FAILURE (AcpiTbValidateTable (Table)))
0280     {
0281         Status = AE_NO_ACPI_TABLES;
0282         goto UnlockAndExit;
0283     }
0284 
0285     /*
0286      * Save the DSDT pointer for simple access. This is the mapped memory
0287      * address. We must take care here because the address of the .Tables
0288      * array can change dynamically as tables are loaded at run-time. Note:
0289      * .Pointer field is not validated until after call to AcpiTbValidateTable.
0290      */
0291     AcpiGbl_DSDT = Table->Pointer;
0292 
0293     /*
0294      * Optionally copy the entire DSDT to local memory (instead of simply
0295      * mapping it.) There are some BIOSs that corrupt or replace the original
0296      * DSDT, creating the need for this option. Default is FALSE, do not copy
0297      * the DSDT.
0298      */
0299     if (AcpiGbl_CopyDsdtLocally)
0300     {
0301         NewDsdt = AcpiTbCopyDsdt (AcpiGbl_DsdtIndex);
0302         if (NewDsdt)
0303         {
0304             AcpiGbl_DSDT = NewDsdt;
0305         }
0306     }
0307 
0308     /*
0309      * Save the original DSDT header for detection of table corruption
0310      * and/or replacement of the DSDT from outside the OS.
0311      */
0312     memcpy (&AcpiGbl_OriginalDsdtHeader, AcpiGbl_DSDT,
0313         sizeof (ACPI_TABLE_HEADER));
0314 
0315     /* Load and parse tables */
0316 
0317     (void) AcpiUtReleaseMutex (ACPI_MTX_TABLES);
0318     Status = AcpiNsLoadTable (AcpiGbl_DsdtIndex, AcpiGbl_RootNode);
0319     (void) AcpiUtAcquireMutex (ACPI_MTX_TABLES);
0320     if (ACPI_FAILURE (Status))
0321     {
0322         ACPI_EXCEPTION ((AE_INFO, Status, "[DSDT] table load failed"));
0323         TablesFailed++;
0324     }
0325     else
0326     {
0327         TablesLoaded++;
0328     }
0329 
0330     /* Load any SSDT or PSDT tables. Note: Loop leaves tables locked */
0331 
0332     for (i = 0; i < AcpiGbl_RootTableList.CurrentTableCount; ++i)
0333     {
0334         Table = &AcpiGbl_RootTableList.Tables[i];
0335 
0336         if (!Table->Address ||
0337             (!ACPI_COMPARE_NAMESEG (Table->Signature.Ascii, ACPI_SIG_SSDT) &&
0338              !ACPI_COMPARE_NAMESEG (Table->Signature.Ascii, ACPI_SIG_PSDT) &&
0339              !ACPI_COMPARE_NAMESEG (Table->Signature.Ascii, ACPI_SIG_OSDT)) ||
0340             ACPI_FAILURE (AcpiTbValidateTable (Table)))
0341         {
0342             continue;
0343         }
0344 
0345         /* Ignore errors while loading tables, get as many as possible */
0346 
0347         (void) AcpiUtReleaseMutex (ACPI_MTX_TABLES);
0348         Status =  AcpiNsLoadTable (i, AcpiGbl_RootNode);
0349         (void) AcpiUtAcquireMutex (ACPI_MTX_TABLES);
0350         if (ACPI_FAILURE (Status))
0351         {
0352             ACPI_EXCEPTION ((AE_INFO, Status, "(%4.4s:%8.8s) while loading table",
0353                 Table->Signature.Ascii, Table->Pointer->OemTableId));
0354 
0355             TablesFailed++;
0356 
0357             ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT,
0358                 "Table [%4.4s:%8.8s] (id FF) - Table namespace load failed\n\n",
0359                 Table->Signature.Ascii, Table->Pointer->OemTableId));
0360         }
0361         else
0362         {
0363             TablesLoaded++;
0364         }
0365     }
0366 
0367     if (!TablesFailed)
0368     {
0369         ACPI_INFO ((
0370             "%u ACPI AML tables successfully acquired and loaded",
0371             TablesLoaded));
0372     }
0373     else
0374     {
0375         ACPI_ERROR ((AE_INFO,
0376             "%u table load failures, %u successful",
0377             TablesFailed, TablesLoaded));
0378 
0379         /* Indicate at least one failure */
0380 
0381         Status = AE_CTRL_TERMINATE;
0382     }
0383 
0384 #ifdef ACPI_APPLICATION
0385     ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT, "\n"));
0386 #endif
0387 
0388 
0389 UnlockAndExit:
0390     (void) AcpiUtReleaseMutex (ACPI_MTX_TABLES);
0391     return_ACPI_STATUS (Status);
0392 }
0393 
0394 
0395 /*******************************************************************************
0396  *
0397  * FUNCTION:    AcpiInstallTable
0398  *
0399  * PARAMETERS:  Table               - Pointer to the ACPI table to be installed.
0400  *
0401  * RETURN:      Status
0402  *
0403  * DESCRIPTION: Dynamically install an ACPI table.
0404  *              Note: This function should only be invoked after
0405  *                    AcpiInitializeTables() and before AcpiLoadTables().
0406  *
0407  ******************************************************************************/
0408 
0409 ACPI_STATUS ACPI_INIT_FUNCTION
0410 AcpiInstallTable (
0411     ACPI_TABLE_HEADER       *Table)
0412 {
0413     ACPI_STATUS             Status;
0414     UINT32                  TableIndex;
0415 
0416 
0417     ACPI_FUNCTION_TRACE (AcpiInstallTable);
0418 
0419 
0420     Status = AcpiTbInstallStandardTable (ACPI_PTR_TO_PHYSADDR (Table),
0421         ACPI_TABLE_ORIGIN_EXTERNAL_VIRTUAL, Table, FALSE, FALSE, &TableIndex);
0422 
0423     return_ACPI_STATUS (Status);
0424 }
0425 
0426 ACPI_EXPORT_SYMBOL_INIT (AcpiInstallTable)
0427 
0428 
0429 /*******************************************************************************
0430  *
0431  * FUNCTION:    AcpiInstallPhysicalTable
0432  *
0433  * PARAMETERS:  Address             - Address of the ACPI table to be installed.
0434  *
0435  * RETURN:      Status
0436  *
0437  * DESCRIPTION: Dynamically install an ACPI table.
0438  *              Note: This function should only be invoked after
0439  *                    AcpiInitializeTables() and before AcpiLoadTables().
0440  *
0441  ******************************************************************************/
0442 
0443 ACPI_STATUS ACPI_INIT_FUNCTION
0444 AcpiInstallPhysicalTable (
0445     ACPI_PHYSICAL_ADDRESS   Address)
0446 {
0447     ACPI_STATUS             Status;
0448     UINT32                  TableIndex;
0449 
0450 
0451     ACPI_FUNCTION_TRACE (AcpiInstallPhysicalTable);
0452 
0453 
0454     Status = AcpiTbInstallStandardTable (Address,
0455         ACPI_TABLE_ORIGIN_INTERNAL_PHYSICAL, NULL, FALSE, FALSE, &TableIndex);
0456 
0457     return_ACPI_STATUS (Status);
0458 }
0459 
0460 ACPI_EXPORT_SYMBOL_INIT (AcpiInstallPhysicalTable)
0461 
0462 
0463 /*******************************************************************************
0464  *
0465  * FUNCTION:    AcpiLoadTable
0466  *
0467  * PARAMETERS:  Table               - Pointer to a buffer containing the ACPI
0468  *                                    table to be loaded.
0469  *              TableIdx            - Pointer to a UINT32 for storing the table
0470  *                                    index, might be NULL
0471  *
0472  * RETURN:      Status
0473  *
0474  * DESCRIPTION: Dynamically load an ACPI table from the caller's buffer. Must
0475  *              be a valid ACPI table with a valid ACPI table header.
0476  *              Note1: Mainly intended to support hotplug addition of SSDTs.
0477  *              Note2: Does not copy the incoming table. User is responsible
0478  *              to ensure that the table is not deleted or unmapped.
0479  *
0480  ******************************************************************************/
0481 
0482 ACPI_STATUS
0483 AcpiLoadTable (
0484     ACPI_TABLE_HEADER       *Table,
0485     UINT32                  *TableIdx)
0486 {
0487     ACPI_STATUS             Status;
0488     UINT32                  TableIndex;
0489 
0490 
0491     ACPI_FUNCTION_TRACE (AcpiLoadTable);
0492 
0493 
0494     /* Parameter validation */
0495 
0496     if (!Table)
0497     {
0498         return_ACPI_STATUS (AE_BAD_PARAMETER);
0499     }
0500 
0501     /* Install the table and load it into the namespace */
0502 
0503     ACPI_INFO (("Host-directed Dynamic ACPI Table Load:"));
0504     Status = AcpiTbInstallAndLoadTable (ACPI_PTR_TO_PHYSADDR (Table),
0505         ACPI_TABLE_ORIGIN_EXTERNAL_VIRTUAL, Table, FALSE, &TableIndex);
0506     if (TableIdx)
0507     {
0508         *TableIdx = TableIndex;
0509     }
0510 
0511     if (ACPI_SUCCESS (Status))
0512     {
0513         /* Complete the initialization/resolution of new objects */
0514 
0515         AcpiNsInitializeObjects ();
0516     }
0517 
0518     return_ACPI_STATUS (Status);
0519 }
0520 
0521 ACPI_EXPORT_SYMBOL (AcpiLoadTable)
0522 
0523 
0524 /*******************************************************************************
0525  *
0526  * FUNCTION:    AcpiUnloadParentTable
0527  *
0528  * PARAMETERS:  Object              - Handle to any namespace object owned by
0529  *                                    the table to be unloaded
0530  *
0531  * RETURN:      Status
0532  *
0533  * DESCRIPTION: Via any namespace object within an SSDT or OEMx table, unloads
0534  *              the table and deletes all namespace objects associated with
0535  *              that table. Unloading of the DSDT is not allowed.
0536  *              Note: Mainly intended to support hotplug removal of SSDTs.
0537  *
0538  ******************************************************************************/
0539 
0540 ACPI_STATUS
0541 AcpiUnloadParentTable (
0542     ACPI_HANDLE             Object)
0543 {
0544     ACPI_NAMESPACE_NODE     *Node = ACPI_CAST_PTR (ACPI_NAMESPACE_NODE, Object);
0545     ACPI_STATUS             Status = AE_NOT_EXIST;
0546     ACPI_OWNER_ID           OwnerId;
0547     UINT32                  i;
0548 
0549 
0550     ACPI_FUNCTION_TRACE (AcpiUnloadParentTable);
0551 
0552 
0553     /* Parameter validation */
0554 
0555     if (!Object)
0556     {
0557         return_ACPI_STATUS (AE_BAD_PARAMETER);
0558     }
0559 
0560     /*
0561      * The node OwnerId is currently the same as the parent table ID.
0562      * However, this could change in the future.
0563      */
0564     OwnerId = Node->OwnerId;
0565     if (!OwnerId)
0566     {
0567         /* OwnerId==0 means DSDT is the owner. DSDT cannot be unloaded */
0568 
0569         return_ACPI_STATUS (AE_TYPE);
0570     }
0571 
0572     /* Must acquire the table lock during this operation */
0573 
0574     Status = AcpiUtAcquireMutex (ACPI_MTX_TABLES);
0575     if (ACPI_FAILURE (Status))
0576     {
0577         return_ACPI_STATUS (Status);
0578     }
0579 
0580     /* Find the table in the global table list */
0581 
0582     for (i = 0; i < AcpiGbl_RootTableList.CurrentTableCount; i++)
0583     {
0584         if (OwnerId != AcpiGbl_RootTableList.Tables[i].OwnerId)
0585         {
0586             continue;
0587         }
0588 
0589         /*
0590          * Allow unload of SSDT and OEMx tables only. Do not allow unload
0591          * of the DSDT. No other types of tables should get here, since
0592          * only these types can contain AML and thus are the only types
0593          * that can create namespace objects.
0594          */
0595         if (ACPI_COMPARE_NAMESEG (
0596                 AcpiGbl_RootTableList.Tables[i].Signature.Ascii,
0597                 ACPI_SIG_DSDT))
0598         {
0599             Status = AE_TYPE;
0600             break;
0601         }
0602 
0603         (void) AcpiUtReleaseMutex (ACPI_MTX_TABLES);
0604         Status = AcpiTbUnloadTable (i);
0605         (void) AcpiUtAcquireMutex (ACPI_MTX_TABLES);
0606         break;
0607     }
0608 
0609     (void) AcpiUtReleaseMutex (ACPI_MTX_TABLES);
0610     return_ACPI_STATUS (Status);
0611 }
0612 
0613 ACPI_EXPORT_SYMBOL (AcpiUnloadParentTable)
0614 
0615 
0616 /*******************************************************************************
0617  *
0618  * FUNCTION:    AcpiUnloadTable
0619  *
0620  * PARAMETERS:  TableIndex          - Index as returned by AcpiLoadTable
0621  *
0622  * RETURN:      Status
0623  *
0624  * DESCRIPTION: Via the TableIndex representing an SSDT or OEMx table, unloads
0625  *              the table and deletes all namespace objects associated with
0626  *              that table. Unloading of the DSDT is not allowed.
0627  *              Note: Mainly intended to support hotplug removal of SSDTs.
0628  *
0629  ******************************************************************************/
0630 
0631 ACPI_STATUS
0632 AcpiUnloadTable (
0633     UINT32                  TableIndex)
0634 {
0635     ACPI_STATUS             Status;
0636 
0637 
0638     ACPI_FUNCTION_TRACE (AcpiUnloadTable);
0639 
0640 
0641     if (TableIndex == 1)
0642     {
0643         /* TableIndex==1 means DSDT is the owner. DSDT cannot be unloaded */
0644 
0645         return_ACPI_STATUS (AE_TYPE);
0646     }
0647 
0648     Status = AcpiTbUnloadTable (TableIndex);
0649     return_ACPI_STATUS (Status);
0650 }
0651 
0652 ACPI_EXPORT_SYMBOL (AcpiUnloadTable)