/******************************************************************************
*
* Module Name: tbdata - Table manager data structure functions
*
*****************************************************************************/
/*
* Copyright (C) 2000 - 2016, 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.
*/
#include "acpi.h"
#include "accommon.h"
#include "acnamesp.h"
#include "actables.h"
ACPI_MODULE_NAME ("tbdata")
/*******************************************************************************
*
* FUNCTION: AcpiTbInitTableDescriptor
*
* PARAMETERS: TableDesc - Table descriptor
* Address - Physical address of the table
* Flags - Allocation flags of the table
* Table - Pointer to the table
*
* RETURN: None
*
* DESCRIPTION: Initialize a new table descriptor
*
******************************************************************************/
void
{
/*
* Initialize the table descriptor. Set the pointer to NULL, since the
* table is not fully mapped at this time.
*/
}
/*******************************************************************************
*
* FUNCTION: AcpiTbAcquireTable
*
* PARAMETERS: TableDesc - Table descriptor
* TablePtr - Where table is returned
* TableLength - Where table length is returned
* TableFlags - Where table allocation flags are returned
*
* RETURN: Status
*
* DESCRIPTION: Acquire an ACPI table. It can be used for tables not
* maintained in the AcpiGbl_RootTableList.
*
******************************************************************************/
{
{
break;
break;
default:
break;
}
/* Table is not valid yet */
if (!Table)
{
return (AE_NO_MEMORY);
}
/* Fill the return values */
return (AE_OK);
}
/*******************************************************************************
*
* FUNCTION: AcpiTbReleaseTable
*
* PARAMETERS: Table - Pointer for the table
* TableLength - Length for the table
* TableFlags - Allocation flags for the table
*
* RETURN: None
*
* DESCRIPTION: Release a table. The inverse of AcpiTbAcquireTable().
*
******************************************************************************/
void
{
switch (TableFlags & ACPI_TABLE_ORIGIN_MASK)
{
break;
default:
break;
}
}
/*******************************************************************************
*
* FUNCTION: AcpiTbAcquireTempTable
*
* PARAMETERS: TableDesc - Table descriptor to be acquired
* Address - Address of the table
* Flags - Allocation flags of the table
*
* RETURN: Status
*
* DESCRIPTION: This function validates the table header to obtain the length
* of a table and fills the table descriptor to make its state as
* "INSTALLED". Such a table descriptor is only used for verified
* installation.
*
******************************************************************************/
{
switch (Flags & ACPI_TABLE_ORIGIN_MASK)
{
/* Get the length of the full table from the header */
if (!TableHeader)
{
return (AE_NO_MEMORY);
}
return (AE_OK);
if (!TableHeader)
{
return (AE_NO_MEMORY);
}
return (AE_OK);
default:
break;
}
/* Table is not valid yet */
return (AE_NO_MEMORY);
}
/*******************************************************************************
*
* FUNCTION: AcpiTbReleaseTempTable
*
* PARAMETERS: TableDesc - Table descriptor to be released
*
* RETURN: Status
*
* DESCRIPTION: The inverse of AcpiTbAcquireTempTable().
*
*****************************************************************************/
void
{
/*
* Note that the .Address is maintained by the callers of
* AcpiTbAcquireTempTable(), thus do not invoke AcpiTbUninstallTable()
* where .Address will be freed.
*/
}
/******************************************************************************
*
* FUNCTION: AcpiTbValidateTable
*
* PARAMETERS: TableDesc - Table descriptor
*
* RETURN: Status
*
* DESCRIPTION: This function is called to validate the table, the returned
* table descriptor is in "VALIDATED" state.
*
*****************************************************************************/
{
/* Validate the table if necessary */
{
{
}
}
}
/*******************************************************************************
*
* FUNCTION: AcpiTbInvalidateTable
*
* PARAMETERS: TableDesc - Table descriptor
*
* RETURN: None
*
* DESCRIPTION: Invalidate one internal ACPI table, this is the inverse of
* AcpiTbValidateTable().
*
******************************************************************************/
void
{
/* Table must be validated */
{
}
}
/******************************************************************************
*
* FUNCTION: AcpiTbValidateTempTable
*
* PARAMETERS: TableDesc - Table descriptor
*
* RETURN: Status
*
* DESCRIPTION: This function is called to validate the table, the returned
* table descriptor is in "VALIDATED" state.
*
*****************************************************************************/
{
{
/*
* Only validates the header of the table.
* Note that Length contains the size of the mapping after invoking
* this work around, this value is required by
* AcpiTbReleaseTempTable().
* We can do this because in AcpiInitTableDescriptor(), the Length
* field of the installed descriptor is filled with the actual
* table length obtaining from the table header.
*/
}
return (AcpiTbValidateTable (TableDesc));
}
/******************************************************************************
*
* FUNCTION: AcpiTbVerifyTempTable
*
* PARAMETERS: TableDesc - Table descriptor
* Signature - Table signature to verify
*
* RETURN: Status
*
* DESCRIPTION: This function is called to validate and verify the table, the
* returned table descriptor is in "VALIDATED" state.
*
*****************************************************************************/
char *Signature)
{
/* Validate the table */
if (ACPI_FAILURE (Status))
{
}
if (Signature &&
{
"Invalid signature 0x%X for ACPI table, expected [%s]",
goto InvalidateAndExit;
}
/* Verify the checksum */
{
if (ACPI_FAILURE (Status))
{
"%4.4s 0x%8.8X%8.8X"
" Attempted table install failed",
goto InvalidateAndExit;
}
}
}
/*******************************************************************************
*
* 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 */
{
}
else
{
}
sizeof (ACPI_TABLE_DESC));
if (!Tables)
{
}
/* Copy and free the previous table array */
{
{
}
}
}
/*******************************************************************************
*
* FUNCTION: AcpiTbGetNextTableDescriptor
*
* PARAMETERS: TableIndex - Where table index is returned
* TableDesc - Where table descriptor is returned
*
* RETURN: Status and table index/descriptor.
*
* DESCRIPTION: Allocate a new ACPI table entry to the global table list
*
******************************************************************************/
{
UINT32 i;
/* Ensure that there is room for the table in the Root Table List */
{
if (ACPI_FAILURE (Status))
{
return (Status);
}
}
if (TableIndex)
{
*TableIndex = i;
}
if (TableDesc)
{
}
return (AE_OK);
}
/*******************************************************************************
*
* 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 - Index into the root table
*
* 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);
}