tbinstal.c revision 26f3cdf03f1adcc98f6d3d99843ee71e9229a8c0
/******************************************************************************
*
* Module Name: tbinstal - ACPI table installation and removal
*
*****************************************************************************/
/*
* Copyright (C) 2000 - 2011, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions, and the following disclaimer,
* without modification.
* 2. Redistributions in binary form must reproduce at minimum a disclaimer
* substantially similar to the "NO WARRANTY" disclaimer below
* ("Disclaimer") and any redistribution must be conditioned upon
* including a substantially similar Disclaimer requirement for further
* binary redistribution.
* 3. Neither the names of the above-listed copyright holders nor the names
* of any contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* Alternatively, this software may be distributed under the terms of the
* GNU General Public License ("GPL") version 2 as published by the Free
* Software Foundation.
*
* NO WARRANTY
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGES.
*/
#define __TBINSTAL_C__
#include "acpi.h"
#include "accommon.h"
#include "acnamesp.h"
#include "actables.h"
#define _COMPONENT ACPI_TABLES
ACPI_MODULE_NAME ("tbinstal")
/******************************************************************************
*
* FUNCTION: AcpiTbVerifyTable
*
* PARAMETERS: TableDesc - table
*
* RETURN: Status
*
* DESCRIPTION: this function is called to verify and map table
*
*****************************************************************************/
{
/* Map the table if necessary */
{
{
}
{
}
}
/* FACS is the odd table, has no standard ACPI header and no checksum */
{
/* Always calculate checksum, ignore bad checksum if requested */
}
}
/*******************************************************************************
*
* FUNCTION: AcpiTbAddTable
*
* PARAMETERS: TableDesc - Table descriptor
* TableIndex - Where the table index is returned
*
* RETURN: Status
*
* DESCRIPTION: This function is called to add an ACPI table. It is used to
* dynamically load tables via the Load and LoadTable AML
* operators.
*
******************************************************************************/
{
UINT32 i;
{
{
}
}
/*
* Validate the incoming table signature.
*
* 1) Originally, we checked the table signature for "SSDT" or "PSDT".
* 2) We added support for OEMx tables, signature "OEM".
* 3) Valid tables were encountered with a null signature, so we just
* gave up on validating the signature, (05/2008).
* 4) We encountered non-AML tables such as the MADT, which caused
* interpreter errors and kernel faults. So now, we once again allow
* only "SSDT", "OEMx", and now, also a null signature. (05/2011).
*/
{
"Table has invalid signature [%4.4s] (0x%8.8X), must be SSDT or OEMx",
}
(void) AcpiUtAcquireMutex (ACPI_MTX_TABLES);
/* Check if table is already registered */
for (i = 0; i < AcpiGbl_RootTableList.CurrentTableCount; ++i)
{
{
if (ACPI_FAILURE (Status) ||
{
continue;
}
}
/*
* Check for a table match on the entire table length,
* not just the header.
*/
{
continue;
}
{
continue;
}
/*
* Note: the current mechanism does not unregister a table if it is
* dynamically unloaded. The related namespace entries are deleted,
* but the table remains in the root table list.
*
* The assumption here is that the number of different tables that
* will be loaded is actually small, and there is minimal overhead
* in just keeping the table in case it is needed again.
*
* If this assumption changes in the future (perhaps on large
* need to be unregistered when they are unloaded, and slots in the
* root table list should be reused when empty.
*/
/*
* Table is already registered.
* We can delete the table that was passed as a parameter.
*/
*TableIndex = i;
{
/* Table is still loaded, this is an error */
goto Release;
}
else
{
/* Table was unloaded, allow it to be reloaded */
goto PrintHeader;
}
}
/*
* ACPI Table Override:
* Allow the host to override dynamically loaded tables.
*/
{
"%4.4s @ 0x%p Table override, replaced with:",
/* We can delete the table that was passed as a parameter */
/* Setup descriptor for the new table */
}
/* Add the table to the global root table list */
if (ACPI_FAILURE (Status))
{
goto Release;
}
(void) AcpiUtReleaseMutex (ACPI_MTX_TABLES);
}
/*******************************************************************************
*
* FUNCTION: AcpiTbResizeRootTableList
*
* PARAMETERS: None
*
* RETURN: Status
*
* DESCRIPTION: Expand the size of global table array
*
******************************************************************************/
void)
{
/* AllowResize flag is a parameter to AcpiInitializeTables */
{
}
/* Increase the Table Array size */
sizeof (ACPI_TABLE_DESC));
if (!Tables)
{
}
/* Copy and free the previous table array */
{
{
}
}
}
/*******************************************************************************
*
* FUNCTION: AcpiTbStoreTable
*
* PARAMETERS: Address - Table address
* Table - Table header
* Length - Table length
* Flags - flags
*
* RETURN: Status and table index.
*
* DESCRIPTION: Add an ACPI table to the global table list
*
******************************************************************************/
{
/* Ensure that there is room for the table in the Root Table List */
{
if (ACPI_FAILURE (Status))
{
return (Status);
}
}
/* Initialize added table */
return (AE_OK);
}
/*******************************************************************************
*
* FUNCTION: AcpiTbDeleteTable
*
* PARAMETERS: TableIndex - Table index
*
* RETURN: None
*
* DESCRIPTION: Delete one internal ACPI table
*
******************************************************************************/
void
{
/* Table must be mapped or allocated */
{
return;
}
{
case ACPI_TABLE_ORIGIN_MAPPED:
break;
break;
default:
break;
}
}
/*******************************************************************************
*
* FUNCTION: AcpiTbTerminate
*
* PARAMETERS: None
*
* RETURN: None
*
* DESCRIPTION: Delete all internal ACPI tables
*
******************************************************************************/
void
void)
{
UINT32 i;
(void) AcpiUtAcquireMutex (ACPI_MTX_TABLES);
/* Delete the individual tables */
for (i = 0; i < AcpiGbl_RootTableList.CurrentTableCount; i++)
{
}
/*
* Delete the root table array if allocated locally. Array cannot be
* mapped, so we don't need to check for that flag.
*/
{
}
(void) AcpiUtReleaseMutex (ACPI_MTX_TABLES);
}
/*******************************************************************************
*
* FUNCTION: AcpiTbDeleteNamespaceByOwner
*
* PARAMETERS: TableIndex - Table index
*
* RETURN: Status
*
* DESCRIPTION: Delete all namespace objects created when this table was loaded.
*
******************************************************************************/
{
if (ACPI_FAILURE (Status))
{
}
{
/* The table index does not exist */
(void) AcpiUtReleaseMutex (ACPI_MTX_TABLES);
}
/* Get the owner ID for this table, used to delete namespace nodes */
(void) AcpiUtReleaseMutex (ACPI_MTX_TABLES);
/*
* Need to acquire the namespace writer lock to prevent interference
* with any concurrent namespace walks. The interpreter must be
* released during the deletion since the acquisition of the deletion
* lock may block, and also since the execution of a namespace walk
* must be allowed to use the interpreter.
*/
(void) AcpiUtReleaseMutex (ACPI_MTX_INTERPRETER);
if (ACPI_FAILURE (Status))
{
}
}
/*******************************************************************************
*
* FUNCTION: AcpiTbAllocateOwnerId
*
* PARAMETERS: TableIndex - Table index
*
* RETURN: Status
*
* DESCRIPTION: Allocates OwnerId in TableDesc
*
******************************************************************************/
{
(void) AcpiUtAcquireMutex (ACPI_MTX_TABLES);
{
}
(void) AcpiUtReleaseMutex (ACPI_MTX_TABLES);
}
/*******************************************************************************
*
* FUNCTION: AcpiTbReleaseOwnerId
*
* PARAMETERS: TableIndex - Table index
*
* RETURN: Status
*
* DESCRIPTION: Releases OwnerId in TableDesc
*
******************************************************************************/
{
(void) AcpiUtAcquireMutex (ACPI_MTX_TABLES);
{
}
(void) AcpiUtReleaseMutex (ACPI_MTX_TABLES);
}
/*******************************************************************************
*
* FUNCTION: AcpiTbGetOwnerId
*
* PARAMETERS: TableIndex - Table index
* OwnerId - Where the table OwnerId is returned
*
* RETURN: Status
*
* DESCRIPTION: returns OwnerId for the ACPI table
*
******************************************************************************/
{
(void) AcpiUtAcquireMutex (ACPI_MTX_TABLES);
{
}
(void) AcpiUtReleaseMutex (ACPI_MTX_TABLES);
}
/*******************************************************************************
*
* FUNCTION: AcpiTbIsTableLoaded
*
* PARAMETERS: TableIndex - Table index
*
* RETURN: Table Loaded Flag
*
******************************************************************************/
{
(void) AcpiUtAcquireMutex (ACPI_MTX_TABLES);
{
}
(void) AcpiUtReleaseMutex (ACPI_MTX_TABLES);
return (IsLoaded);
}
/*******************************************************************************
*
* FUNCTION: AcpiTbSetTableLoadedFlag
*
* PARAMETERS: TableIndex - Table index
* IsLoaded - TRUE if table is loaded, FALSE otherwise
*
* RETURN: None
*
* DESCRIPTION: Sets the table loaded flag to either TRUE or FALSE.
*
******************************************************************************/
void
{
(void) AcpiUtAcquireMutex (ACPI_MTX_TABLES);
{
if (IsLoaded)
{
}
else
{
}
}
(void) AcpiUtReleaseMutex (ACPI_MTX_TABLES);
}