summaryrefslogtreecommitdiff
path: root/usr/src/uts/intel/io/acpica/tables
diff options
context:
space:
mode:
Diffstat (limited to 'usr/src/uts/intel/io/acpica/tables')
-rw-r--r--usr/src/uts/intel/io/acpica/tables/tbdata.c869
-rw-r--r--usr/src/uts/intel/io/acpica/tables/tbfadt.c781
-rw-r--r--usr/src/uts/intel/io/acpica/tables/tbfind.c156
-rw-r--r--usr/src/uts/intel/io/acpica/tables/tbinstal.c528
-rw-r--r--usr/src/uts/intel/io/acpica/tables/tbprint.c272
-rw-r--r--usr/src/uts/intel/io/acpica/tables/tbutils.c413
-rw-r--r--usr/src/uts/intel/io/acpica/tables/tbxface.c527
-rw-r--r--usr/src/uts/intel/io/acpica/tables/tbxfload.c538
-rw-r--r--usr/src/uts/intel/io/acpica/tables/tbxfroot.c323
9 files changed, 0 insertions, 4407 deletions
diff --git a/usr/src/uts/intel/io/acpica/tables/tbdata.c b/usr/src/uts/intel/io/acpica/tables/tbdata.c
deleted file mode 100644
index 31fa25b92e..0000000000
--- a/usr/src/uts/intel/io/acpica/tables/tbdata.c
+++ /dev/null
@@ -1,869 +0,0 @@
-/******************************************************************************
- *
- * 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"
-
-#define _COMPONENT ACPI_TABLES
- 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
-AcpiTbInitTableDescriptor (
- ACPI_TABLE_DESC *TableDesc,
- ACPI_PHYSICAL_ADDRESS Address,
- UINT8 Flags,
- ACPI_TABLE_HEADER *Table)
-{
-
- /*
- * Initialize the table descriptor. Set the pointer to NULL, since the
- * table is not fully mapped at this time.
- */
- memset (TableDesc, 0, sizeof (ACPI_TABLE_DESC));
- TableDesc->Address = Address;
- TableDesc->Length = Table->Length;
- TableDesc->Flags = Flags;
- ACPI_MOVE_32_TO_32 (TableDesc->Signature.Ascii, Table->Signature);
-}
-
-
-/*******************************************************************************
- *
- * 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.
- *
- ******************************************************************************/
-
-ACPI_STATUS
-AcpiTbAcquireTable (
- ACPI_TABLE_DESC *TableDesc,
- ACPI_TABLE_HEADER **TablePtr,
- UINT32 *TableLength,
- UINT8 *TableFlags)
-{
- ACPI_TABLE_HEADER *Table = NULL;
-
-
- switch (TableDesc->Flags & ACPI_TABLE_ORIGIN_MASK)
- {
- case ACPI_TABLE_ORIGIN_INTERNAL_PHYSICAL:
-
- Table = AcpiOsMapMemory (TableDesc->Address, TableDesc->Length);
- break;
-
- case ACPI_TABLE_ORIGIN_INTERNAL_VIRTUAL:
- case ACPI_TABLE_ORIGIN_EXTERNAL_VIRTUAL:
-
- Table = ACPI_CAST_PTR (ACPI_TABLE_HEADER,
- ACPI_PHYSADDR_TO_PTR (TableDesc->Address));
- break;
-
- default:
-
- break;
- }
-
- /* Table is not valid yet */
-
- if (!Table)
- {
- return (AE_NO_MEMORY);
- }
-
- /* Fill the return values */
-
- *TablePtr = Table;
- *TableLength = TableDesc->Length;
- *TableFlags = TableDesc->Flags;
- 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
-AcpiTbReleaseTable (
- ACPI_TABLE_HEADER *Table,
- UINT32 TableLength,
- UINT8 TableFlags)
-{
-
- switch (TableFlags & ACPI_TABLE_ORIGIN_MASK)
- {
- case ACPI_TABLE_ORIGIN_INTERNAL_PHYSICAL:
-
- AcpiOsUnmapMemory (Table, TableLength);
- break;
-
- case ACPI_TABLE_ORIGIN_INTERNAL_VIRTUAL:
- case ACPI_TABLE_ORIGIN_EXTERNAL_VIRTUAL:
- 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.
- *
- ******************************************************************************/
-
-ACPI_STATUS
-AcpiTbAcquireTempTable (
- ACPI_TABLE_DESC *TableDesc,
- ACPI_PHYSICAL_ADDRESS Address,
- UINT8 Flags)
-{
- ACPI_TABLE_HEADER *TableHeader;
-
-
- switch (Flags & ACPI_TABLE_ORIGIN_MASK)
- {
- case ACPI_TABLE_ORIGIN_INTERNAL_PHYSICAL:
-
- /* Get the length of the full table from the header */
-
- TableHeader = AcpiOsMapMemory (Address, sizeof (ACPI_TABLE_HEADER));
- if (!TableHeader)
- {
- return (AE_NO_MEMORY);
- }
-
- AcpiTbInitTableDescriptor (TableDesc, Address, Flags, TableHeader);
- AcpiOsUnmapMemory (TableHeader, sizeof (ACPI_TABLE_HEADER));
- return (AE_OK);
-
- case ACPI_TABLE_ORIGIN_INTERNAL_VIRTUAL:
- case ACPI_TABLE_ORIGIN_EXTERNAL_VIRTUAL:
-
- TableHeader = ACPI_CAST_PTR (ACPI_TABLE_HEADER,
- ACPI_PHYSADDR_TO_PTR (Address));
- if (!TableHeader)
- {
- return (AE_NO_MEMORY);
- }
-
- AcpiTbInitTableDescriptor (TableDesc, Address, Flags, TableHeader);
- 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
-AcpiTbReleaseTempTable (
- ACPI_TABLE_DESC *TableDesc)
-{
-
- /*
- * Note that the .Address is maintained by the callers of
- * AcpiTbAcquireTempTable(), thus do not invoke AcpiTbUninstallTable()
- * where .Address will be freed.
- */
- AcpiTbInvalidateTable (TableDesc);
-}
-
-
-/******************************************************************************
- *
- * 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.
- *
- *****************************************************************************/
-
-ACPI_STATUS
-AcpiTbValidateTable (
- ACPI_TABLE_DESC *TableDesc)
-{
- ACPI_STATUS Status = AE_OK;
-
-
- ACPI_FUNCTION_TRACE (TbValidateTable);
-
-
- /* Validate the table if necessary */
-
- if (!TableDesc->Pointer)
- {
- Status = AcpiTbAcquireTable (TableDesc, &TableDesc->Pointer,
- &TableDesc->Length, &TableDesc->Flags);
- if (!TableDesc->Pointer)
- {
- Status = AE_NO_MEMORY;
- }
- }
-
- return_ACPI_STATUS (Status);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiTbInvalidateTable
- *
- * PARAMETERS: TableDesc - Table descriptor
- *
- * RETURN: None
- *
- * DESCRIPTION: Invalidate one internal ACPI table, this is the inverse of
- * AcpiTbValidateTable().
- *
- ******************************************************************************/
-
-void
-AcpiTbInvalidateTable (
- ACPI_TABLE_DESC *TableDesc)
-{
-
- ACPI_FUNCTION_TRACE (TbInvalidateTable);
-
-
- /* Table must be validated */
-
- if (!TableDesc->Pointer)
- {
- return_VOID;
- }
-
- AcpiTbReleaseTable (TableDesc->Pointer, TableDesc->Length,
- TableDesc->Flags);
- TableDesc->Pointer = NULL;
-
- return_VOID;
-}
-
-
-/******************************************************************************
- *
- * 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.
- *
- *****************************************************************************/
-
-ACPI_STATUS
-AcpiTbValidateTempTable (
- ACPI_TABLE_DESC *TableDesc)
-{
-
- if (!TableDesc->Pointer && !AcpiGbl_VerifyTableChecksum)
- {
- /*
- * 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.
- */
- TableDesc->Length = sizeof (ACPI_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.
- *
- *****************************************************************************/
-
-ACPI_STATUS
-AcpiTbVerifyTempTable (
- ACPI_TABLE_DESC *TableDesc,
- char *Signature)
-{
- ACPI_STATUS Status = AE_OK;
-
-
- ACPI_FUNCTION_TRACE (TbVerifyTempTable);
-
-
- /* Validate the table */
-
- Status = AcpiTbValidateTempTable (TableDesc);
- if (ACPI_FAILURE (Status))
- {
- return_ACPI_STATUS (AE_NO_MEMORY);
- }
-
- /* If a particular signature is expected (DSDT/FACS), it must match */
-
- if (Signature &&
- !ACPI_COMPARE_NAME (&TableDesc->Signature, Signature))
- {
- ACPI_BIOS_ERROR ((AE_INFO,
- "Invalid signature 0x%X for ACPI table, expected [%s]",
- TableDesc->Signature.Integer, Signature));
- Status = AE_BAD_SIGNATURE;
- goto InvalidateAndExit;
- }
-
- /* Verify the checksum */
-
- if (AcpiGbl_VerifyTableChecksum)
- {
- Status = AcpiTbVerifyChecksum (TableDesc->Pointer, TableDesc->Length);
- if (ACPI_FAILURE (Status))
- {
- ACPI_EXCEPTION ((AE_INFO, AE_NO_MEMORY,
- "%4.4s 0x%8.8X%8.8X"
- " Attempted table install failed",
- AcpiUtValidNameseg (TableDesc->Signature.Ascii) ?
- TableDesc->Signature.Ascii : "????",
- ACPI_FORMAT_UINT64 (TableDesc->Address)));
-
- goto InvalidateAndExit;
- }
- }
-
- return_ACPI_STATUS (AE_OK);
-
-InvalidateAndExit:
- AcpiTbInvalidateTable (TableDesc);
- return_ACPI_STATUS (Status);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiTbResizeRootTableList
- *
- * PARAMETERS: None
- *
- * RETURN: Status
- *
- * DESCRIPTION: Expand the size of global table array
- *
- ******************************************************************************/
-
-ACPI_STATUS
-AcpiTbResizeRootTableList (
- void)
-{
- ACPI_TABLE_DESC *Tables;
- UINT32 TableCount;
-
-
- ACPI_FUNCTION_TRACE (TbResizeRootTableList);
-
-
- /* AllowResize flag is a parameter to AcpiInitializeTables */
-
- if (!(AcpiGbl_RootTableList.Flags & ACPI_ROOT_ALLOW_RESIZE))
- {
- ACPI_ERROR ((AE_INFO, "Resize of Root Table Array is not allowed"));
- return_ACPI_STATUS (AE_SUPPORT);
- }
-
- /* Increase the Table Array size */
-
- if (AcpiGbl_RootTableList.Flags & ACPI_ROOT_ORIGIN_ALLOCATED)
- {
- TableCount = AcpiGbl_RootTableList.MaxTableCount;
- }
- else
- {
- TableCount = AcpiGbl_RootTableList.CurrentTableCount;
- }
-
- Tables = ACPI_ALLOCATE_ZEROED (
- ((ACPI_SIZE) TableCount + ACPI_ROOT_TABLE_SIZE_INCREMENT) *
- sizeof (ACPI_TABLE_DESC));
- if (!Tables)
- {
- ACPI_ERROR ((AE_INFO, "Could not allocate new root table array"));
- return_ACPI_STATUS (AE_NO_MEMORY);
- }
-
- /* Copy and free the previous table array */
-
- if (AcpiGbl_RootTableList.Tables)
- {
- memcpy (Tables, AcpiGbl_RootTableList.Tables,
- (ACPI_SIZE) TableCount * sizeof (ACPI_TABLE_DESC));
-
- if (AcpiGbl_RootTableList.Flags & ACPI_ROOT_ORIGIN_ALLOCATED)
- {
- ACPI_FREE (AcpiGbl_RootTableList.Tables);
- }
- }
-
- AcpiGbl_RootTableList.Tables = Tables;
- AcpiGbl_RootTableList.MaxTableCount =
- TableCount + ACPI_ROOT_TABLE_SIZE_INCREMENT;
- AcpiGbl_RootTableList.Flags |= ACPI_ROOT_ORIGIN_ALLOCATED;
-
- return_ACPI_STATUS (AE_OK);
-}
-
-
-/*******************************************************************************
- *
- * 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
- *
- ******************************************************************************/
-
-ACPI_STATUS
-AcpiTbGetNextTableDescriptor (
- UINT32 *TableIndex,
- ACPI_TABLE_DESC **TableDesc)
-{
- ACPI_STATUS Status;
- UINT32 i;
-
-
- /* Ensure that there is room for the table in the Root Table List */
-
- if (AcpiGbl_RootTableList.CurrentTableCount >=
- AcpiGbl_RootTableList.MaxTableCount)
- {
- Status = AcpiTbResizeRootTableList();
- if (ACPI_FAILURE (Status))
- {
- return (Status);
- }
- }
-
- i = AcpiGbl_RootTableList.CurrentTableCount;
- AcpiGbl_RootTableList.CurrentTableCount++;
-
- if (TableIndex)
- {
- *TableIndex = i;
- }
- if (TableDesc)
- {
- *TableDesc = &AcpiGbl_RootTableList.Tables[i];
- }
-
- return (AE_OK);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiTbTerminate
- *
- * PARAMETERS: None
- *
- * RETURN: None
- *
- * DESCRIPTION: Delete all internal ACPI tables
- *
- ******************************************************************************/
-
-void
-AcpiTbTerminate (
- void)
-{
- UINT32 i;
-
-
- ACPI_FUNCTION_TRACE (TbTerminate);
-
-
- (void) AcpiUtAcquireMutex (ACPI_MTX_TABLES);
-
- /* Delete the individual tables */
-
- for (i = 0; i < AcpiGbl_RootTableList.CurrentTableCount; i++)
- {
- AcpiTbUninstallTable (&AcpiGbl_RootTableList.Tables[i]);
- }
-
- /*
- * Delete the root table array if allocated locally. Array cannot be
- * mapped, so we don't need to check for that flag.
- */
- if (AcpiGbl_RootTableList.Flags & ACPI_ROOT_ORIGIN_ALLOCATED)
- {
- ACPI_FREE (AcpiGbl_RootTableList.Tables);
- }
-
- AcpiGbl_RootTableList.Tables = NULL;
- AcpiGbl_RootTableList.Flags = 0;
- AcpiGbl_RootTableList.CurrentTableCount = 0;
-
- ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "ACPI Tables freed\n"));
-
- (void) AcpiUtReleaseMutex (ACPI_MTX_TABLES);
- return_VOID;
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiTbDeleteNamespaceByOwner
- *
- * PARAMETERS: TableIndex - Table index
- *
- * RETURN: Status
- *
- * DESCRIPTION: Delete all namespace objects created when this table was loaded.
- *
- ******************************************************************************/
-
-ACPI_STATUS
-AcpiTbDeleteNamespaceByOwner (
- UINT32 TableIndex)
-{
- ACPI_OWNER_ID OwnerId;
- ACPI_STATUS Status;
-
-
- ACPI_FUNCTION_TRACE (TbDeleteNamespaceByOwner);
-
-
- Status = AcpiUtAcquireMutex (ACPI_MTX_TABLES);
- if (ACPI_FAILURE (Status))
- {
- return_ACPI_STATUS (Status);
- }
-
- if (TableIndex >= AcpiGbl_RootTableList.CurrentTableCount)
- {
- /* The table index does not exist */
-
- (void) AcpiUtReleaseMutex (ACPI_MTX_TABLES);
- return_ACPI_STATUS (AE_NOT_EXIST);
- }
-
- /* Get the owner ID for this table, used to delete namespace nodes */
-
- OwnerId = AcpiGbl_RootTableList.Tables[TableIndex].OwnerId;
- (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);
- Status = AcpiUtAcquireWriteLock (&AcpiGbl_NamespaceRwLock);
-
- AcpiNsDeleteNamespaceByOwner (OwnerId);
- if (ACPI_FAILURE (Status))
- {
- return_ACPI_STATUS (Status);
- }
-
- AcpiUtReleaseWriteLock (&AcpiGbl_NamespaceRwLock);
-
- Status = AcpiUtAcquireMutex (ACPI_MTX_INTERPRETER);
- return_ACPI_STATUS (Status);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiTbAllocateOwnerId
- *
- * PARAMETERS: TableIndex - Table index
- *
- * RETURN: Status
- *
- * DESCRIPTION: Allocates OwnerId in TableDesc
- *
- ******************************************************************************/
-
-ACPI_STATUS
-AcpiTbAllocateOwnerId (
- UINT32 TableIndex)
-{
- ACPI_STATUS Status = AE_BAD_PARAMETER;
-
-
- ACPI_FUNCTION_TRACE (TbAllocateOwnerId);
-
-
- (void) AcpiUtAcquireMutex (ACPI_MTX_TABLES);
- if (TableIndex < AcpiGbl_RootTableList.CurrentTableCount)
- {
- Status = AcpiUtAllocateOwnerId (
- &(AcpiGbl_RootTableList.Tables[TableIndex].OwnerId));
- }
-
- (void) AcpiUtReleaseMutex (ACPI_MTX_TABLES);
- return_ACPI_STATUS (Status);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiTbReleaseOwnerId
- *
- * PARAMETERS: TableIndex - Table index
- *
- * RETURN: Status
- *
- * DESCRIPTION: Releases OwnerId in TableDesc
- *
- ******************************************************************************/
-
-ACPI_STATUS
-AcpiTbReleaseOwnerId (
- UINT32 TableIndex)
-{
- ACPI_STATUS Status = AE_BAD_PARAMETER;
-
-
- ACPI_FUNCTION_TRACE (TbReleaseOwnerId);
-
-
- (void) AcpiUtAcquireMutex (ACPI_MTX_TABLES);
- if (TableIndex < AcpiGbl_RootTableList.CurrentTableCount)
- {
- AcpiUtReleaseOwnerId (
- &(AcpiGbl_RootTableList.Tables[TableIndex].OwnerId));
- Status = AE_OK;
- }
-
- (void) AcpiUtReleaseMutex (ACPI_MTX_TABLES);
- return_ACPI_STATUS (Status);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiTbGetOwnerId
- *
- * PARAMETERS: TableIndex - Table index
- * OwnerId - Where the table OwnerId is returned
- *
- * RETURN: Status
- *
- * DESCRIPTION: returns OwnerId for the ACPI table
- *
- ******************************************************************************/
-
-ACPI_STATUS
-AcpiTbGetOwnerId (
- UINT32 TableIndex,
- ACPI_OWNER_ID *OwnerId)
-{
- ACPI_STATUS Status = AE_BAD_PARAMETER;
-
-
- ACPI_FUNCTION_TRACE (TbGetOwnerId);
-
-
- (void) AcpiUtAcquireMutex (ACPI_MTX_TABLES);
- if (TableIndex < AcpiGbl_RootTableList.CurrentTableCount)
- {
- *OwnerId = AcpiGbl_RootTableList.Tables[TableIndex].OwnerId;
- Status = AE_OK;
- }
-
- (void) AcpiUtReleaseMutex (ACPI_MTX_TABLES);
- return_ACPI_STATUS (Status);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiTbIsTableLoaded
- *
- * PARAMETERS: TableIndex - Index into the root table
- *
- * RETURN: Table Loaded Flag
- *
- ******************************************************************************/
-
-BOOLEAN
-AcpiTbIsTableLoaded (
- UINT32 TableIndex)
-{
- BOOLEAN IsLoaded = FALSE;
-
-
- (void) AcpiUtAcquireMutex (ACPI_MTX_TABLES);
- if (TableIndex < AcpiGbl_RootTableList.CurrentTableCount)
- {
- IsLoaded = (BOOLEAN)
- (AcpiGbl_RootTableList.Tables[TableIndex].Flags &
- ACPI_TABLE_IS_LOADED);
- }
-
- (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
-AcpiTbSetTableLoadedFlag (
- UINT32 TableIndex,
- BOOLEAN IsLoaded)
-{
-
- (void) AcpiUtAcquireMutex (ACPI_MTX_TABLES);
- if (TableIndex < AcpiGbl_RootTableList.CurrentTableCount)
- {
- if (IsLoaded)
- {
- AcpiGbl_RootTableList.Tables[TableIndex].Flags |=
- ACPI_TABLE_IS_LOADED;
- }
- else
- {
- AcpiGbl_RootTableList.Tables[TableIndex].Flags &=
- ~ACPI_TABLE_IS_LOADED;
- }
- }
-
- (void) AcpiUtReleaseMutex (ACPI_MTX_TABLES);
-}
diff --git a/usr/src/uts/intel/io/acpica/tables/tbfadt.c b/usr/src/uts/intel/io/acpica/tables/tbfadt.c
deleted file mode 100644
index 51eb49b42a..0000000000
--- a/usr/src/uts/intel/io/acpica/tables/tbfadt.c
+++ /dev/null
@@ -1,781 +0,0 @@
-/******************************************************************************
- *
- * Module Name: tbfadt - FADT table utilities
- *
- *****************************************************************************/
-
-/*
- * 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 "actables.h"
-
-#define _COMPONENT ACPI_TABLES
- ACPI_MODULE_NAME ("tbfadt")
-
-/* Local prototypes */
-
-static void
-AcpiTbInitGenericAddress (
- ACPI_GENERIC_ADDRESS *GenericAddress,
- UINT8 SpaceId,
- UINT8 ByteWidth,
- UINT64 Address,
- const char *RegisterName,
- UINT8 Flags);
-
-static void
-AcpiTbConvertFadt (
- void);
-
-static void
-AcpiTbSetupFadtRegisters (
- void);
-
-static UINT64
-AcpiTbSelectAddress (
- char *RegisterName,
- UINT32 Address32,
- UINT64 Address64);
-
-
-/* Table for conversion of FADT to common internal format and FADT validation */
-
-typedef struct acpi_fadt_info
-{
- const char *Name;
- UINT16 Address64;
- UINT16 Address32;
- UINT16 Length;
- UINT8 DefaultLength;
- UINT8 Flags;
-
-} ACPI_FADT_INFO;
-
-#define ACPI_FADT_OPTIONAL 0
-#define ACPI_FADT_REQUIRED 1
-#define ACPI_FADT_SEPARATE_LENGTH 2
-#define ACPI_FADT_GPE_REGISTER 4
-
-static ACPI_FADT_INFO FadtInfoTable[] =
-{
- {"Pm1aEventBlock",
- ACPI_FADT_OFFSET (XPm1aEventBlock),
- ACPI_FADT_OFFSET (Pm1aEventBlock),
- ACPI_FADT_OFFSET (Pm1EventLength),
- ACPI_PM1_REGISTER_WIDTH * 2, /* Enable + Status register */
- ACPI_FADT_REQUIRED},
-
- {"Pm1bEventBlock",
- ACPI_FADT_OFFSET (XPm1bEventBlock),
- ACPI_FADT_OFFSET (Pm1bEventBlock),
- ACPI_FADT_OFFSET (Pm1EventLength),
- ACPI_PM1_REGISTER_WIDTH * 2, /* Enable + Status register */
- ACPI_FADT_OPTIONAL},
-
- {"Pm1aControlBlock",
- ACPI_FADT_OFFSET (XPm1aControlBlock),
- ACPI_FADT_OFFSET (Pm1aControlBlock),
- ACPI_FADT_OFFSET (Pm1ControlLength),
- ACPI_PM1_REGISTER_WIDTH,
- ACPI_FADT_REQUIRED},
-
- {"Pm1bControlBlock",
- ACPI_FADT_OFFSET (XPm1bControlBlock),
- ACPI_FADT_OFFSET (Pm1bControlBlock),
- ACPI_FADT_OFFSET (Pm1ControlLength),
- ACPI_PM1_REGISTER_WIDTH,
- ACPI_FADT_OPTIONAL},
-
- {"Pm2ControlBlock",
- ACPI_FADT_OFFSET (XPm2ControlBlock),
- ACPI_FADT_OFFSET (Pm2ControlBlock),
- ACPI_FADT_OFFSET (Pm2ControlLength),
- ACPI_PM2_REGISTER_WIDTH,
- ACPI_FADT_SEPARATE_LENGTH},
-
- {"PmTimerBlock",
- ACPI_FADT_OFFSET (XPmTimerBlock),
- ACPI_FADT_OFFSET (PmTimerBlock),
- ACPI_FADT_OFFSET (PmTimerLength),
- ACPI_PM_TIMER_WIDTH,
- ACPI_FADT_SEPARATE_LENGTH}, /* ACPI 5.0A: Timer is optional */
-
- {"Gpe0Block",
- ACPI_FADT_OFFSET (XGpe0Block),
- ACPI_FADT_OFFSET (Gpe0Block),
- ACPI_FADT_OFFSET (Gpe0BlockLength),
- 0,
- ACPI_FADT_SEPARATE_LENGTH | ACPI_FADT_GPE_REGISTER},
-
- {"Gpe1Block",
- ACPI_FADT_OFFSET (XGpe1Block),
- ACPI_FADT_OFFSET (Gpe1Block),
- ACPI_FADT_OFFSET (Gpe1BlockLength),
- 0,
- ACPI_FADT_SEPARATE_LENGTH | ACPI_FADT_GPE_REGISTER}
-};
-
-#define ACPI_FADT_INFO_ENTRIES \
- (sizeof (FadtInfoTable) / sizeof (ACPI_FADT_INFO))
-
-
-/* Table used to split Event Blocks into separate status/enable registers */
-
-typedef struct acpi_fadt_pm_info
-{
- ACPI_GENERIC_ADDRESS *Target;
- UINT16 Source;
- UINT8 RegisterNum;
-
-} ACPI_FADT_PM_INFO;
-
-static ACPI_FADT_PM_INFO FadtPmInfoTable[] =
-{
- {&AcpiGbl_XPm1aStatus,
- ACPI_FADT_OFFSET (XPm1aEventBlock),
- 0},
-
- {&AcpiGbl_XPm1aEnable,
- ACPI_FADT_OFFSET (XPm1aEventBlock),
- 1},
-
- {&AcpiGbl_XPm1bStatus,
- ACPI_FADT_OFFSET (XPm1bEventBlock),
- 0},
-
- {&AcpiGbl_XPm1bEnable,
- ACPI_FADT_OFFSET (XPm1bEventBlock),
- 1}
-};
-
-#define ACPI_FADT_PM_INFO_ENTRIES \
- (sizeof (FadtPmInfoTable) / sizeof (ACPI_FADT_PM_INFO))
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiTbInitGenericAddress
- *
- * PARAMETERS: GenericAddress - GAS struct to be initialized
- * SpaceId - ACPI Space ID for this register
- * ByteWidth - Width of this register
- * Address - Address of the register
- * RegisterName - ASCII name of the ACPI register
- *
- * RETURN: None
- *
- * DESCRIPTION: Initialize a Generic Address Structure (GAS)
- * See the ACPI specification for a full description and
- * definition of this structure.
- *
- ******************************************************************************/
-
-static void
-AcpiTbInitGenericAddress (
- ACPI_GENERIC_ADDRESS *GenericAddress,
- UINT8 SpaceId,
- UINT8 ByteWidth,
- UINT64 Address,
- const char *RegisterName,
- UINT8 Flags)
-{
- UINT8 BitWidth;
-
-
- /*
- * Bit width field in the GAS is only one byte long, 255 max.
- * Check for BitWidth overflow in GAS.
- */
- BitWidth = (UINT8) (ByteWidth * 8);
- if (ByteWidth > 31) /* (31*8)=248, (32*8)=256 */
- {
- /*
- * No error for GPE blocks, because we do not use the BitWidth
- * for GPEs, the legacy length (ByteWidth) is used instead to
- * allow for a large number of GPEs.
- */
- if (!(Flags & ACPI_FADT_GPE_REGISTER))
- {
- ACPI_ERROR ((AE_INFO,
- "%s - 32-bit FADT register is too long (%u bytes, %u bits) "
- "to convert to GAS struct - 255 bits max, truncating",
- RegisterName, ByteWidth, (ByteWidth * 8)));
- }
-
- BitWidth = 255;
- }
-
- /*
- * The 64-bit Address field is non-aligned in the byte packed
- * GAS struct.
- */
- ACPI_MOVE_64_TO_64 (&GenericAddress->Address, &Address);
-
- /* All other fields are byte-wide */
-
- GenericAddress->SpaceId = SpaceId;
- GenericAddress->BitWidth = BitWidth;
- GenericAddress->BitOffset = 0;
- GenericAddress->AccessWidth = 0; /* Access width ANY */
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiTbSelectAddress
- *
- * PARAMETERS: RegisterName - ASCII name of the ACPI register
- * Address32 - 32-bit address of the register
- * Address64 - 64-bit address of the register
- *
- * RETURN: The resolved 64-bit address
- *
- * DESCRIPTION: Select between 32-bit and 64-bit versions of addresses within
- * the FADT. Used for the FACS and DSDT addresses.
- *
- * NOTES:
- *
- * Check for FACS and DSDT address mismatches. An address mismatch between
- * the 32-bit and 64-bit address fields (FIRMWARE_CTRL/X_FIRMWARE_CTRL and
- * DSDT/X_DSDT) could be a corrupted address field or it might indicate
- * the presence of two FACS or two DSDT tables.
- *
- * November 2013:
- * By default, as per the ACPICA specification, a valid 64-bit address is
- * used regardless of the value of the 32-bit address. However, this
- * behavior can be overridden via the AcpiGbl_Use32BitFadtAddresses flag.
- *
- ******************************************************************************/
-
-static UINT64
-AcpiTbSelectAddress (
- char *RegisterName,
- UINT32 Address32,
- UINT64 Address64)
-{
-
- if (!Address64)
- {
- /* 64-bit address is zero, use 32-bit address */
-
- return ((UINT64) Address32);
- }
-
- if (Address32 &&
- (Address64 != (UINT64) Address32))
- {
- /* Address mismatch between 32-bit and 64-bit versions */
-
- ACPI_BIOS_WARNING ((AE_INFO,
- "32/64X %s address mismatch in FADT: "
- "0x%8.8X/0x%8.8X%8.8X, using %u-bit address",
- RegisterName, Address32, ACPI_FORMAT_UINT64 (Address64),
- AcpiGbl_Use32BitFadtAddresses ? 32 : 64));
-
- /* 32-bit address override */
-
- if (AcpiGbl_Use32BitFadtAddresses)
- {
- return ((UINT64) Address32);
- }
- }
-
- /* Default is to use the 64-bit address */
-
- return (Address64);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiTbParseFadt
- *
- * PARAMETERS: None
- *
- * RETURN: None
- *
- * DESCRIPTION: Initialize the FADT, DSDT and FACS tables
- * (FADT contains the addresses of the DSDT and FACS)
- *
- ******************************************************************************/
-
-void
-AcpiTbParseFadt (
- void)
-{
- UINT32 Length;
- ACPI_TABLE_HEADER *Table;
-
-
- /*
- * The FADT has multiple versions with different lengths,
- * and it contains pointers to both the DSDT and FACS tables.
- *
- * Get a local copy of the FADT and convert it to a common format
- * Map entire FADT, assumed to be smaller than one page.
- */
- Length = AcpiGbl_RootTableList.Tables[AcpiGbl_FadtIndex].Length;
-
- Table = AcpiOsMapMemory (
- AcpiGbl_RootTableList.Tables[AcpiGbl_FadtIndex].Address, Length);
- if (!Table)
- {
- return;
- }
-
- /*
- * Validate the FADT checksum before we copy the table. Ignore
- * checksum error as we want to try to get the DSDT and FACS.
- */
- (void) AcpiTbVerifyChecksum (Table, Length);
-
- /* Create a local copy of the FADT in common ACPI 2.0+ format */
-
- AcpiTbCreateLocalFadt (Table, Length);
-
- /* All done with the real FADT, unmap it */
-
- AcpiOsUnmapMemory (Table, Length);
-
- /* Obtain the DSDT and FACS tables via their addresses within the FADT */
-
- AcpiTbInstallFixedTable ((ACPI_PHYSICAL_ADDRESS) AcpiGbl_FADT.XDsdt,
- ACPI_SIG_DSDT, &AcpiGbl_DsdtIndex);
-
- /* If Hardware Reduced flag is set, there is no FACS */
-
- if (!AcpiGbl_ReducedHardware)
- {
- if (AcpiGbl_FADT.Facs)
- {
- AcpiTbInstallFixedTable ((ACPI_PHYSICAL_ADDRESS) AcpiGbl_FADT.Facs,
- ACPI_SIG_FACS, &AcpiGbl_FacsIndex);
- }
- if (AcpiGbl_FADT.XFacs)
- {
- AcpiTbInstallFixedTable ((ACPI_PHYSICAL_ADDRESS) AcpiGbl_FADT.XFacs,
- ACPI_SIG_FACS, &AcpiGbl_XFacsIndex);
- }
- }
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiTbCreateLocalFadt
- *
- * PARAMETERS: Table - Pointer to BIOS FADT
- * Length - Length of the table
- *
- * RETURN: None
- *
- * DESCRIPTION: Get a local copy of the FADT and convert it to a common format.
- * Performs validation on some important FADT fields.
- *
- * NOTE: We create a local copy of the FADT regardless of the version.
- *
- ******************************************************************************/
-
-void
-AcpiTbCreateLocalFadt (
- ACPI_TABLE_HEADER *Table,
- UINT32 Length)
-{
-
- /*
- * Check if the FADT is larger than the largest table that we expect
- * (typically the current ACPI specification version). If so, truncate
- * the table, and issue a warning.
- */
- if (Length > sizeof (ACPI_TABLE_FADT))
- {
- ACPI_BIOS_WARNING ((AE_INFO,
- "FADT (revision %u) is longer than %s length, "
- "truncating length %u to %u",
- Table->Revision, ACPI_FADT_CONFORMANCE, Length,
- (UINT32) sizeof (ACPI_TABLE_FADT)));
- }
-
- /* Clear the entire local FADT */
-
- memset (&AcpiGbl_FADT, 0, sizeof (ACPI_TABLE_FADT));
-
- /* Copy the original FADT, up to sizeof (ACPI_TABLE_FADT) */
-
- memcpy (&AcpiGbl_FADT, Table,
- ACPI_MIN (Length, sizeof (ACPI_TABLE_FADT)));
-
- /* Take a copy of the Hardware Reduced flag */
-
- AcpiGbl_ReducedHardware = FALSE;
- if (AcpiGbl_FADT.Flags & ACPI_FADT_HW_REDUCED)
- {
- AcpiGbl_ReducedHardware = TRUE;
- }
-
- /* Convert the local copy of the FADT to the common internal format */
-
- AcpiTbConvertFadt ();
-
- /* Initialize the global ACPI register structures */
-
- AcpiTbSetupFadtRegisters ();
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiTbConvertFadt
- *
- * PARAMETERS: None - AcpiGbl_FADT is used.
- *
- * RETURN: None
- *
- * DESCRIPTION: Converts all versions of the FADT to a common internal format.
- * Expand 32-bit addresses to 64-bit as necessary. Also validate
- * important fields within the FADT.
- *
- * NOTE: AcpiGbl_FADT must be of size (ACPI_TABLE_FADT), and must
- * contain a copy of the actual BIOS-provided FADT.
- *
- * Notes on 64-bit register addresses:
- *
- * After this FADT conversion, later ACPICA code will only use the 64-bit "X"
- * fields of the FADT for all ACPI register addresses.
- *
- * The 64-bit X fields are optional extensions to the original 32-bit FADT
- * V1.0 fields. Even if they are present in the FADT, they are optional and
- * are unused if the BIOS sets them to zero. Therefore, we must copy/expand
- * 32-bit V1.0 fields to the 64-bit X fields if the the 64-bit X field is
- * originally zero.
- *
- * For ACPI 1.0 FADTs (that contain no 64-bit addresses), all 32-bit address
- * fields are expanded to the corresponding 64-bit X fields in the internal
- * common FADT.
- *
- * For ACPI 2.0+ FADTs, all valid (non-zero) 32-bit address fields are expanded
- * to the corresponding 64-bit X fields, if the 64-bit field is originally
- * zero. Adhering to the ACPI specification, we completely ignore the 32-bit
- * field if the 64-bit field is valid, regardless of whether the host OS is
- * 32-bit or 64-bit.
- *
- * Possible additional checks:
- * (AcpiGbl_FADT.Pm1EventLength >= 4)
- * (AcpiGbl_FADT.Pm1ControlLength >= 2)
- * (AcpiGbl_FADT.PmTimerLength >= 4)
- * Gpe block lengths must be multiple of 2
- *
- ******************************************************************************/
-
-static void
-AcpiTbConvertFadt (
- void)
-{
- const char *Name;
- ACPI_GENERIC_ADDRESS *Address64;
- UINT32 Address32;
- UINT8 Length;
- UINT8 Flags;
- UINT32 i;
-
-
- /*
- * For ACPI 1.0 FADTs (revision 1 or 2), ensure that reserved fields which
- * should be zero are indeed zero. This will workaround BIOSs that
- * inadvertently place values in these fields.
- *
- * The ACPI 1.0 reserved fields that will be zeroed are the bytes located
- * at offset 45, 55, 95, and the word located at offset 109, 110.
- *
- * Note: The FADT revision value is unreliable. Only the length can be
- * trusted.
- */
- if (AcpiGbl_FADT.Header.Length <= ACPI_FADT_V2_SIZE)
- {
- AcpiGbl_FADT.PreferredProfile = 0;
- AcpiGbl_FADT.PstateControl = 0;
- AcpiGbl_FADT.CstControl = 0;
- AcpiGbl_FADT.BootFlags = 0;
- }
-
- /*
- * Now we can update the local FADT length to the length of the
- * current FADT version as defined by the ACPI specification.
- * Thus, we will have a common FADT internally.
- */
- AcpiGbl_FADT.Header.Length = sizeof (ACPI_TABLE_FADT);
-
- /*
- * Expand the 32-bit DSDT addresses to 64-bit as necessary.
- * Later ACPICA code will always use the X 64-bit field.
- */
- AcpiGbl_FADT.XDsdt = AcpiTbSelectAddress ("DSDT",
- AcpiGbl_FADT.Dsdt, AcpiGbl_FADT.XDsdt);
-
- /* If Hardware Reduced flag is set, we are all done */
-
- if (AcpiGbl_ReducedHardware)
- {
- return;
- }
-
- /* Examine all of the 64-bit extended address fields (X fields) */
-
- for (i = 0; i < ACPI_FADT_INFO_ENTRIES; i++)
- {
- /*
- * Get the 32-bit and 64-bit addresses, as well as the register
- * length and register name.
- */
- Address32 = *ACPI_ADD_PTR (UINT32,
- &AcpiGbl_FADT, FadtInfoTable[i].Address32);
-
- Address64 = ACPI_ADD_PTR (ACPI_GENERIC_ADDRESS,
- &AcpiGbl_FADT, FadtInfoTable[i].Address64);
-
- Length = *ACPI_ADD_PTR (UINT8,
- &AcpiGbl_FADT, FadtInfoTable[i].Length);
-
- Name = FadtInfoTable[i].Name;
- Flags = FadtInfoTable[i].Flags;
-
- /*
- * Expand the ACPI 1.0 32-bit addresses to the ACPI 2.0 64-bit "X"
- * generic address structures as necessary. Later code will always use
- * the 64-bit address structures.
- *
- * November 2013:
- * Now always use the 64-bit address if it is valid (non-zero), in
- * accordance with the ACPI specification which states that a 64-bit
- * address supersedes the 32-bit version. This behavior can be
- * overridden by the AcpiGbl_Use32BitFadtAddresses flag.
- *
- * During 64-bit address construction and verification,
- * these cases are handled:
- *
- * Address32 zero, Address64 [don't care] - Use Address64
- *
- * Address32 non-zero, Address64 zero - Copy/use Address32
- * Address32 non-zero == Address64 non-zero - Use Address64
- * Address32 non-zero != Address64 non-zero - Warning, use Address64
- *
- * Override: if AcpiGbl_Use32BitFadtAddresses is TRUE, and:
- * Address32 non-zero != Address64 non-zero - Warning, copy/use Address32
- *
- * Note: SpaceId is always I/O for 32-bit legacy address fields
- */
- if (Address32)
- {
- if (!Address64->Address)
- {
- /* 64-bit address is zero, use 32-bit address */
-
- AcpiTbInitGenericAddress (Address64,
- ACPI_ADR_SPACE_SYSTEM_IO,
- *ACPI_ADD_PTR (UINT8, &AcpiGbl_FADT,
- FadtInfoTable[i].Length),
- (UINT64) Address32, Name, Flags);
- }
- else if (Address64->Address != (UINT64) Address32)
- {
- /* Address mismatch */
-
- ACPI_BIOS_WARNING ((AE_INFO,
- "32/64X address mismatch in FADT/%s: "
- "0x%8.8X/0x%8.8X%8.8X, using %u-bit address",
- Name, Address32,
- ACPI_FORMAT_UINT64 (Address64->Address),
- AcpiGbl_Use32BitFadtAddresses ? 32 : 64));
-
- if (AcpiGbl_Use32BitFadtAddresses)
- {
- /* 32-bit address override */
-
- AcpiTbInitGenericAddress (Address64,
- ACPI_ADR_SPACE_SYSTEM_IO,
- *ACPI_ADD_PTR (UINT8, &AcpiGbl_FADT,
- FadtInfoTable[i].Length),
- (UINT64) Address32, Name, Flags);
- }
- }
- }
-
- /*
- * For each extended field, check for length mismatch between the
- * legacy length field and the corresponding 64-bit X length field.
- * Note: If the legacy length field is > 0xFF bits, ignore this
- * check. (GPE registers can be larger than the 64-bit GAS structure
- * can accomodate, 0xFF bits).
- */
- if (Address64->Address &&
- (ACPI_MUL_8 (Length) <= ACPI_UINT8_MAX) &&
- (Address64->BitWidth != ACPI_MUL_8 (Length)))
- {
- ACPI_BIOS_WARNING ((AE_INFO,
- "32/64X length mismatch in FADT/%s: %u/%u",
- Name, ACPI_MUL_8 (Length), Address64->BitWidth));
- }
-
- if (FadtInfoTable[i].Flags & ACPI_FADT_REQUIRED)
- {
- /*
- * Field is required (PM1aEvent, PM1aControl).
- * Both the address and length must be non-zero.
- */
- if (!Address64->Address || !Length)
- {
- ACPI_BIOS_ERROR ((AE_INFO,
- "Required FADT field %s has zero address and/or length: "
- "0x%8.8X%8.8X/0x%X",
- Name, ACPI_FORMAT_UINT64 (Address64->Address), Length));
- }
- }
- else if (FadtInfoTable[i].Flags & ACPI_FADT_SEPARATE_LENGTH)
- {
- /*
- * Field is optional (PM2Control, GPE0, GPE1) AND has its own
- * length field. If present, both the address and length must
- * be valid.
- */
- if ((Address64->Address && !Length) ||
- (!Address64->Address && Length))
- {
- ACPI_BIOS_WARNING ((AE_INFO,
- "Optional FADT field %s has valid %s but zero %s: "
- "0x%8.8X%8.8X/0x%X", Name,
- (Length ? "Length" : "Address"),
- (Length ? "Address": "Length"),
- ACPI_FORMAT_UINT64 (Address64->Address), Length));
- }
- }
- }
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiTbSetupFadtRegisters
- *
- * PARAMETERS: None, uses AcpiGbl_FADT.
- *
- * RETURN: None
- *
- * DESCRIPTION: Initialize global ACPI PM1 register definitions. Optionally,
- * force FADT register definitions to their default lengths.
- *
- ******************************************************************************/
-
-static void
-AcpiTbSetupFadtRegisters (
- void)
-{
- ACPI_GENERIC_ADDRESS *Target64;
- ACPI_GENERIC_ADDRESS *Source64;
- UINT8 Pm1RegisterByteWidth;
- UINT32 i;
-
-
- /*
- * Optionally check all register lengths against the default values and
- * update them if they are incorrect.
- */
- if (AcpiGbl_UseDefaultRegisterWidths)
- {
- for (i = 0; i < ACPI_FADT_INFO_ENTRIES; i++)
- {
- Target64 = ACPI_ADD_PTR (ACPI_GENERIC_ADDRESS, &AcpiGbl_FADT,
- FadtInfoTable[i].Address64);
-
- /*
- * If a valid register (Address != 0) and the (DefaultLength > 0)
- * (Not a GPE register), then check the width against the default.
- */
- if ((Target64->Address) &&
- (FadtInfoTable[i].DefaultLength > 0) &&
- (FadtInfoTable[i].DefaultLength != Target64->BitWidth))
- {
- ACPI_BIOS_WARNING ((AE_INFO,
- "Invalid length for FADT/%s: %u, using default %u",
- FadtInfoTable[i].Name, Target64->BitWidth,
- FadtInfoTable[i].DefaultLength));
-
- /* Incorrect size, set width to the default */
-
- Target64->BitWidth = FadtInfoTable[i].DefaultLength;
- }
- }
- }
-
- /*
- * Get the length of the individual PM1 registers (enable and status).
- * Each register is defined to be (event block length / 2). Extra divide
- * by 8 converts bits to bytes.
- */
- Pm1RegisterByteWidth = (UINT8)
- ACPI_DIV_16 (AcpiGbl_FADT.XPm1aEventBlock.BitWidth);
-
- /*
- * Calculate separate GAS structs for the PM1x (A/B) Status and Enable
- * registers. These addresses do not appear (directly) in the FADT, so it
- * is useful to pre-calculate them from the PM1 Event Block definitions.
- *
- * The PM event blocks are split into two register blocks, first is the
- * PM Status Register block, followed immediately by the PM Enable
- * Register block. Each is of length (Pm1EventLength/2)
- *
- * Note: The PM1A event block is required by the ACPI specification.
- * However, the PM1B event block is optional and is rarely, if ever,
- * used.
- */
-
- for (i = 0; i < ACPI_FADT_PM_INFO_ENTRIES; i++)
- {
- Source64 = ACPI_ADD_PTR (ACPI_GENERIC_ADDRESS, &AcpiGbl_FADT,
- FadtPmInfoTable[i].Source);
-
- if (Source64->Address)
- {
- AcpiTbInitGenericAddress (FadtPmInfoTable[i].Target,
- Source64->SpaceId, Pm1RegisterByteWidth,
- Source64->Address +
- (FadtPmInfoTable[i].RegisterNum * Pm1RegisterByteWidth),
- "PmRegisters", 0);
- }
- }
-}
diff --git a/usr/src/uts/intel/io/acpica/tables/tbfind.c b/usr/src/uts/intel/io/acpica/tables/tbfind.c
deleted file mode 100644
index 32839a3cd3..0000000000
--- a/usr/src/uts/intel/io/acpica/tables/tbfind.c
+++ /dev/null
@@ -1,156 +0,0 @@
-/******************************************************************************
- *
- * Module Name: tbfind - find table
- *
- *****************************************************************************/
-
-/*
- * 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 "actables.h"
-
-#define _COMPONENT ACPI_TABLES
- ACPI_MODULE_NAME ("tbfind")
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiTbFindTable
- *
- * PARAMETERS: Signature - String with ACPI table signature
- * OemId - String with the table OEM ID
- * OemTableId - String with the OEM Table ID
- * TableIndex - Where the table index is returned
- *
- * RETURN: Status and table index
- *
- * DESCRIPTION: Find an ACPI table (in the RSDT/XSDT) that matches the
- * Signature, OEM ID and OEM Table ID. Returns an index that can
- * be used to get the table header or entire table.
- *
- ******************************************************************************/
-
-ACPI_STATUS
-AcpiTbFindTable (
- char *Signature,
- char *OemId,
- char *OemTableId,
- UINT32 *TableIndex)
-{
- ACPI_STATUS Status;
- ACPI_TABLE_HEADER Header;
- UINT32 i;
-
-
- ACPI_FUNCTION_TRACE (TbFindTable);
-
-
- /* Validate the input table signature */
-
- if (!AcpiUtValidNameseg (Signature))
- {
- return_ACPI_STATUS (AE_BAD_SIGNATURE);
- }
-
- /* Don't allow the OEM strings to be too long */
-
- if ((strlen (OemId) > ACPI_OEM_ID_SIZE) ||
- (strlen (OemTableId) > ACPI_OEM_TABLE_ID_SIZE))
- {
- return_ACPI_STATUS (AE_AML_STRING_LIMIT);
- }
-
- /* Normalize the input strings */
-
- memset (&Header, 0, sizeof (ACPI_TABLE_HEADER));
- ACPI_MOVE_NAME (Header.Signature, Signature);
- strncpy (Header.OemId, OemId, ACPI_OEM_ID_SIZE);
- strncpy (Header.OemTableId, OemTableId, ACPI_OEM_TABLE_ID_SIZE);
-
- /* Search for the table */
-
- for (i = 0; i < AcpiGbl_RootTableList.CurrentTableCount; ++i)
- {
- if (memcmp (&(AcpiGbl_RootTableList.Tables[i].Signature),
- Header.Signature, ACPI_NAME_SIZE))
- {
- /* Not the requested table */
-
- continue;
- }
-
- /* Table with matching signature has been found */
-
- if (!AcpiGbl_RootTableList.Tables[i].Pointer)
- {
- /* Table is not currently mapped, map it */
-
- Status = AcpiTbValidateTable (&AcpiGbl_RootTableList.Tables[i]);
- if (ACPI_FAILURE (Status))
- {
- return_ACPI_STATUS (Status);
- }
-
- if (!AcpiGbl_RootTableList.Tables[i].Pointer)
- {
- continue;
- }
- }
-
- /* Check for table match on all IDs */
-
- if (!memcmp (AcpiGbl_RootTableList.Tables[i].Pointer->Signature,
- Header.Signature, ACPI_NAME_SIZE) &&
- (!OemId[0] ||
- !memcmp (AcpiGbl_RootTableList.Tables[i].Pointer->OemId,
- Header.OemId, ACPI_OEM_ID_SIZE)) &&
- (!OemTableId[0] ||
- !memcmp (AcpiGbl_RootTableList.Tables[i].Pointer->OemTableId,
- Header.OemTableId, ACPI_OEM_TABLE_ID_SIZE)))
- {
- *TableIndex = i;
-
- ACPI_DEBUG_PRINT ((ACPI_DB_TABLES, "Found table [%4.4s]\n",
- Header.Signature));
- return_ACPI_STATUS (AE_OK);
- }
- }
-
- return_ACPI_STATUS (AE_NOT_FOUND);
-}
diff --git a/usr/src/uts/intel/io/acpica/tables/tbinstal.c b/usr/src/uts/intel/io/acpica/tables/tbinstal.c
deleted file mode 100644
index 78e8b4ec8b..0000000000
--- a/usr/src/uts/intel/io/acpica/tables/tbinstal.c
+++ /dev/null
@@ -1,528 +0,0 @@
-/******************************************************************************
- *
- * Module Name: tbinstal - ACPI table installation and removal
- *
- *****************************************************************************/
-
-/*
- * 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 "actables.h"
-
-#define _COMPONENT ACPI_TABLES
- ACPI_MODULE_NAME ("tbinstal")
-
-/* Local prototypes */
-
-static BOOLEAN
-AcpiTbCompareTables (
- ACPI_TABLE_DESC *TableDesc,
- UINT32 TableIndex);
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiTbCompareTables
- *
- * PARAMETERS: TableDesc - Table 1 descriptor to be compared
- * TableIndex - Index of table 2 to be compared
- *
- * RETURN: TRUE if both tables are identical.
- *
- * DESCRIPTION: This function compares a table with another table that has
- * already been installed in the root table list.
- *
- ******************************************************************************/
-
-static BOOLEAN
-AcpiTbCompareTables (
- ACPI_TABLE_DESC *TableDesc,
- UINT32 TableIndex)
-{
- ACPI_STATUS Status = AE_OK;
- BOOLEAN IsIdentical;
- ACPI_TABLE_HEADER *Table;
- UINT32 TableLength;
- UINT8 TableFlags;
-
-
- Status = AcpiTbAcquireTable (&AcpiGbl_RootTableList.Tables[TableIndex],
- &Table, &TableLength, &TableFlags);
- if (ACPI_FAILURE (Status))
- {
- return (FALSE);
- }
-
- /*
- * Check for a table match on the entire table length,
- * not just the header.
- */
- IsIdentical = (BOOLEAN)((TableDesc->Length != TableLength ||
- memcmp (TableDesc->Pointer, Table, TableLength)) ?
- FALSE : TRUE);
-
- /* Release the acquired table */
-
- AcpiTbReleaseTable (Table, TableLength, TableFlags);
- return (IsIdentical);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiTbInstallTableWithOverride
- *
- * PARAMETERS: NewTableDesc - New table descriptor to install
- * Override - Whether override should be performed
- * TableIndex - Where the table index is returned
- *
- * RETURN: None
- *
- * DESCRIPTION: Install an ACPI table into the global data structure. The
- * table override mechanism is called to allow the host
- * OS to replace any table before it is installed in the root
- * table array.
- *
- ******************************************************************************/
-
-void
-AcpiTbInstallTableWithOverride (
- ACPI_TABLE_DESC *NewTableDesc,
- BOOLEAN Override,
- UINT32 *TableIndex)
-{
- UINT32 i;
- ACPI_STATUS Status;
-
-
- Status = AcpiTbGetNextTableDescriptor (&i, NULL);
- if (ACPI_FAILURE (Status))
- {
- return;
- }
-
- /*
- * ACPI Table Override:
- *
- * Before we install the table, let the host OS override it with a new
- * one if desired. Any table within the RSDT/XSDT can be replaced,
- * including the DSDT which is pointed to by the FADT.
- */
- if (Override)
- {
- AcpiTbOverrideTable (NewTableDesc);
- }
-
- AcpiTbInitTableDescriptor (&AcpiGbl_RootTableList.Tables[i],
- NewTableDesc->Address, NewTableDesc->Flags, NewTableDesc->Pointer);
-
- AcpiTbPrintTableHeader (NewTableDesc->Address, NewTableDesc->Pointer);
-
- /* This synchronizes AcpiGbl_DsdtIndex */
-
- *TableIndex = i;
-
- /* Set the global integer width (based upon revision of the DSDT) */
-
- if (i == AcpiGbl_DsdtIndex)
- {
- AcpiUtSetIntegerWidth (NewTableDesc->Pointer->Revision);
- }
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiTbInstallFixedTable
- *
- * PARAMETERS: Address - Physical address of DSDT or FACS
- * Signature - Table signature, NULL if no need to
- * match
- * TableIndex - Where the table index is returned
- *
- * RETURN: Status
- *
- * DESCRIPTION: Install a fixed ACPI table (DSDT/FACS) into the global data
- * structure.
- *
- ******************************************************************************/
-
-ACPI_STATUS
-AcpiTbInstallFixedTable (
- ACPI_PHYSICAL_ADDRESS Address,
- char *Signature,
- UINT32 *TableIndex)
-{
- ACPI_TABLE_DESC NewTableDesc;
- ACPI_STATUS Status;
-
-
- ACPI_FUNCTION_TRACE (TbInstallFixedTable);
-
-
- if (!Address)
- {
- ACPI_ERROR ((AE_INFO, "Null physical address for ACPI table [%s]",
- Signature));
- return (AE_NO_MEMORY);
- }
-
- /* Fill a table descriptor for validation */
-
- Status = AcpiTbAcquireTempTable (&NewTableDesc, Address,
- ACPI_TABLE_ORIGIN_INTERNAL_PHYSICAL);
- if (ACPI_FAILURE (Status))
- {
- ACPI_ERROR ((AE_INFO, "Could not acquire table length at %8.8X%8.8X",
- ACPI_FORMAT_UINT64 (Address)));
- return_ACPI_STATUS (Status);
- }
-
- /* Validate and verify a table before installation */
-
- Status = AcpiTbVerifyTempTable (&NewTableDesc, Signature);
- if (ACPI_FAILURE (Status))
- {
- goto ReleaseAndExit;
- }
-
- /* Add the table to the global root table list */
-
- AcpiTbInstallTableWithOverride (&NewTableDesc, TRUE, TableIndex);
-
-ReleaseAndExit:
-
- /* Release the temporary table descriptor */
-
- AcpiTbReleaseTempTable (&NewTableDesc);
- return_ACPI_STATUS (Status);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiTbInstallStandardTable
- *
- * PARAMETERS: Address - Address of the table (might be a virtual
- * address depending on the TableFlags)
- * Flags - Flags for the table
- * Reload - Whether reload should be performed
- * Override - Whether override should be performed
- * TableIndex - Where the table index is returned
- *
- * RETURN: Status
- *
- * DESCRIPTION: This function is called to install an ACPI table that is
- * neither DSDT nor FACS (a "standard" table.)
- * When this function is called by "Load" or "LoadTable" opcodes,
- * or by AcpiLoadTable() API, the "Reload" parameter is set.
- * After sucessfully returning from this function, table is
- * "INSTALLED" but not "VALIDATED".
- *
- ******************************************************************************/
-
-ACPI_STATUS
-AcpiTbInstallStandardTable (
- ACPI_PHYSICAL_ADDRESS Address,
- UINT8 Flags,
- BOOLEAN Reload,
- BOOLEAN Override,
- UINT32 *TableIndex)
-{
- UINT32 i;
- ACPI_STATUS Status = AE_OK;
- ACPI_TABLE_DESC NewTableDesc;
-
-
- ACPI_FUNCTION_TRACE (TbInstallStandardTable);
-
-
- /* Acquire a temporary table descriptor for validation */
-
- Status = AcpiTbAcquireTempTable (&NewTableDesc, Address, Flags);
- if (ACPI_FAILURE (Status))
- {
- ACPI_ERROR ((AE_INFO,
- "Could not acquire table length at %8.8X%8.8X",
- ACPI_FORMAT_UINT64 (Address)));
- return_ACPI_STATUS (Status);
- }
-
- /*
- * Optionally do not load any SSDTs from the RSDT/XSDT. This can
- * be useful for debugging ACPI problems on some machines.
- */
- if (!Reload &&
- AcpiGbl_DisableSsdtTableInstall &&
- ACPI_COMPARE_NAME (&NewTableDesc.Signature, ACPI_SIG_SSDT))
- {
- ACPI_INFO ((
- "Ignoring installation of %4.4s at %8.8X%8.8X",
- NewTableDesc.Signature.Ascii, ACPI_FORMAT_UINT64 (Address)));
- goto ReleaseAndExit;
- }
-
- /* Validate and verify a table before installation */
-
- Status = AcpiTbVerifyTempTable (&NewTableDesc, NULL);
- if (ACPI_FAILURE (Status))
- {
- goto ReleaseAndExit;
- }
-
- if (Reload)
- {
- /*
- * 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).
- */
- if ((NewTableDesc.Signature.Ascii[0] != 0x00) &&
- (!ACPI_COMPARE_NAME (&NewTableDesc.Signature, ACPI_SIG_SSDT)) &&
- (strncmp (NewTableDesc.Signature.Ascii, "OEM", 3)))
- {
- ACPI_BIOS_ERROR ((AE_INFO,
- "Table has invalid signature [%4.4s] (0x%8.8X), "
- "must be SSDT or OEMx",
- AcpiUtValidNameseg (NewTableDesc.Signature.Ascii) ?
- NewTableDesc.Signature.Ascii : "????",
- NewTableDesc.Signature.Integer));
-
- Status = AE_BAD_SIGNATURE;
- goto ReleaseAndExit;
- }
-
- /* Check if table is already registered */
-
- for (i = 0; i < AcpiGbl_RootTableList.CurrentTableCount; ++i)
- {
- /*
- * Check for a table match on the entire table length,
- * not just the header.
- */
- if (!AcpiTbCompareTables (&NewTableDesc, i))
- {
- 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
- * machines with many table load/unload operations), tables will
- * need to be unregistered when they are unloaded, and slots in the
- * root table list should be reused when empty.
- */
- if (AcpiGbl_RootTableList.Tables[i].Flags &
- ACPI_TABLE_IS_LOADED)
- {
- /* Table is still loaded, this is an error */
-
- Status = AE_ALREADY_EXISTS;
- goto ReleaseAndExit;
- }
- else
- {
- /*
- * Table was unloaded, allow it to be reloaded.
- * As we are going to return AE_OK to the caller, we should
- * take the responsibility of freeing the input descriptor.
- * Refill the input descriptor to ensure
- * AcpiTbInstallTableWithOverride() can be called again to
- * indicate the re-installation.
- */
- AcpiTbUninstallTable (&NewTableDesc);
- *TableIndex = i;
- return_ACPI_STATUS (AE_OK);
- }
- }
- }
-
- /* Add the table to the global root table list */
-
- AcpiTbInstallTableWithOverride (&NewTableDesc, Override, TableIndex);
-
-ReleaseAndExit:
-
- /* Release the temporary table descriptor */
-
- AcpiTbReleaseTempTable (&NewTableDesc);
- return_ACPI_STATUS (Status);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiTbOverrideTable
- *
- * PARAMETERS: OldTableDesc - Validated table descriptor to be
- * overridden
- *
- * RETURN: None
- *
- * DESCRIPTION: Attempt table override by calling the OSL override functions.
- * Note: If the table is overridden, then the entire new table
- * is acquired and returned by this function.
- * Before/after invocation, the table descriptor is in a state
- * that is "VALIDATED".
- *
- ******************************************************************************/
-
-void
-AcpiTbOverrideTable (
- ACPI_TABLE_DESC *OldTableDesc)
-{
- ACPI_STATUS Status;
- char *OverrideType;
- ACPI_TABLE_DESC NewTableDesc;
- ACPI_TABLE_HEADER *Table;
- ACPI_PHYSICAL_ADDRESS Address;
- UINT32 Length;
-
-
- /* (1) Attempt logical override (returns a logical address) */
-
- Status = AcpiOsTableOverride (OldTableDesc->Pointer, &Table);
- if (ACPI_SUCCESS (Status) && Table)
- {
- AcpiTbAcquireTempTable (&NewTableDesc, ACPI_PTR_TO_PHYSADDR (Table),
- ACPI_TABLE_ORIGIN_EXTERNAL_VIRTUAL);
- OverrideType = "Logical";
- goto FinishOverride;
- }
-
- /* (2) Attempt physical override (returns a physical address) */
-
- Status = AcpiOsPhysicalTableOverride (OldTableDesc->Pointer,
- &Address, &Length);
- if (ACPI_SUCCESS (Status) && Address && Length)
- {
- AcpiTbAcquireTempTable (&NewTableDesc, Address,
- ACPI_TABLE_ORIGIN_INTERNAL_PHYSICAL);
- OverrideType = "Physical";
- goto FinishOverride;
- }
-
- return; /* There was no override */
-
-
-FinishOverride:
-
- /* Validate and verify a table before overriding */
-
- Status = AcpiTbVerifyTempTable (&NewTableDesc, NULL);
- if (ACPI_FAILURE (Status))
- {
- return;
- }
-
- ACPI_INFO (("%4.4s 0x%8.8X%8.8X"
- " %s table override, new table: 0x%8.8X%8.8X",
- OldTableDesc->Signature.Ascii,
- ACPI_FORMAT_UINT64 (OldTableDesc->Address),
- OverrideType, ACPI_FORMAT_UINT64 (NewTableDesc.Address)));
-
- /* We can now uninstall the original table */
-
- AcpiTbUninstallTable (OldTableDesc);
-
- /*
- * Replace the original table descriptor and keep its state as
- * "VALIDATED".
- */
- AcpiTbInitTableDescriptor (OldTableDesc, NewTableDesc.Address,
- NewTableDesc.Flags, NewTableDesc.Pointer);
- AcpiTbValidateTempTable (OldTableDesc);
-
- /* Release the temporary table descriptor */
-
- AcpiTbReleaseTempTable (&NewTableDesc);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiTbUninstallTable
- *
- * PARAMETERS: TableDesc - Table descriptor
- *
- * RETURN: None
- *
- * DESCRIPTION: Delete one internal ACPI table
- *
- ******************************************************************************/
-
-void
-AcpiTbUninstallTable (
- ACPI_TABLE_DESC *TableDesc)
-{
-
- ACPI_FUNCTION_TRACE (TbUninstallTable);
-
-
- /* Table must be installed */
-
- if (!TableDesc->Address)
- {
- return_VOID;
- }
-
- AcpiTbInvalidateTable (TableDesc);
-
- if ((TableDesc->Flags & ACPI_TABLE_ORIGIN_MASK) ==
- ACPI_TABLE_ORIGIN_INTERNAL_VIRTUAL)
- {
- ACPI_FREE (ACPI_PHYSADDR_TO_PTR (TableDesc->Address));
- }
-
- TableDesc->Address = ACPI_PTR_TO_PHYSADDR (NULL);
- return_VOID;
-}
diff --git a/usr/src/uts/intel/io/acpica/tables/tbprint.c b/usr/src/uts/intel/io/acpica/tables/tbprint.c
deleted file mode 100644
index 9dab6d9d4a..0000000000
--- a/usr/src/uts/intel/io/acpica/tables/tbprint.c
+++ /dev/null
@@ -1,272 +0,0 @@
-/******************************************************************************
- *
- * Module Name: tbprint - Table output utilities
- *
- *****************************************************************************/
-
-/*
- * 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 "actables.h"
-
-#define _COMPONENT ACPI_TABLES
- ACPI_MODULE_NAME ("tbprint")
-
-
-/* Local prototypes */
-
-static void
-AcpiTbFixString (
- char *String,
- ACPI_SIZE Length);
-
-static void
-AcpiTbCleanupTableHeader (
- ACPI_TABLE_HEADER *OutHeader,
- ACPI_TABLE_HEADER *Header);
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiTbFixString
- *
- * PARAMETERS: String - String to be repaired
- * Length - Maximum length
- *
- * RETURN: None
- *
- * DESCRIPTION: Replace every non-printable or non-ascii byte in the string
- * with a question mark '?'.
- *
- ******************************************************************************/
-
-static void
-AcpiTbFixString (
- char *String,
- ACPI_SIZE Length)
-{
-
- while (Length && *String)
- {
- if (!isprint ((int) *String))
- {
- *String = '?';
- }
-
- String++;
- Length--;
- }
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiTbCleanupTableHeader
- *
- * PARAMETERS: OutHeader - Where the cleaned header is returned
- * Header - Input ACPI table header
- *
- * RETURN: Returns the cleaned header in OutHeader
- *
- * DESCRIPTION: Copy the table header and ensure that all "string" fields in
- * the header consist of printable characters.
- *
- ******************************************************************************/
-
-static void
-AcpiTbCleanupTableHeader (
- ACPI_TABLE_HEADER *OutHeader,
- ACPI_TABLE_HEADER *Header)
-{
-
- memcpy (OutHeader, Header, sizeof (ACPI_TABLE_HEADER));
-
- AcpiTbFixString (OutHeader->Signature, ACPI_NAME_SIZE);
- AcpiTbFixString (OutHeader->OemId, ACPI_OEM_ID_SIZE);
- AcpiTbFixString (OutHeader->OemTableId, ACPI_OEM_TABLE_ID_SIZE);
- AcpiTbFixString (OutHeader->AslCompilerId, ACPI_NAME_SIZE);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiTbPrintTableHeader
- *
- * PARAMETERS: Address - Table physical address
- * Header - Table header
- *
- * RETURN: None
- *
- * DESCRIPTION: Print an ACPI table header. Special cases for FACS and RSDP.
- *
- ******************************************************************************/
-
-void
-AcpiTbPrintTableHeader (
- ACPI_PHYSICAL_ADDRESS Address,
- ACPI_TABLE_HEADER *Header)
-{
- ACPI_TABLE_HEADER LocalHeader;
-
-
- if (ACPI_COMPARE_NAME (Header->Signature, ACPI_SIG_FACS))
- {
- /* FACS only has signature and length fields */
-
- ACPI_INFO (("%-4.4s 0x%8.8X%8.8X %06X",
- Header->Signature, ACPI_FORMAT_UINT64 (Address),
- Header->Length));
- }
- else if (ACPI_VALIDATE_RSDP_SIG (Header->Signature))
- {
- /* RSDP has no common fields */
-
- memcpy (LocalHeader.OemId, ACPI_CAST_PTR (ACPI_TABLE_RSDP,
- Header)->OemId, ACPI_OEM_ID_SIZE);
- AcpiTbFixString (LocalHeader.OemId, ACPI_OEM_ID_SIZE);
-
- ACPI_INFO (("RSDP 0x%8.8X%8.8X %06X (v%.2d %-6.6s)",
- ACPI_FORMAT_UINT64 (Address),
- (ACPI_CAST_PTR (ACPI_TABLE_RSDP, Header)->Revision > 0) ?
- ACPI_CAST_PTR (ACPI_TABLE_RSDP, Header)->Length : 20,
- ACPI_CAST_PTR (ACPI_TABLE_RSDP, Header)->Revision,
- LocalHeader.OemId));
- }
- else
- {
- /* Standard ACPI table with full common header */
-
- AcpiTbCleanupTableHeader (&LocalHeader, Header);
-
- ACPI_INFO ((
- "%-4.4s 0x%8.8X%8.8X"
- " %06X (v%.2d %-6.6s %-8.8s %08X %-4.4s %08X)",
- LocalHeader.Signature, ACPI_FORMAT_UINT64 (Address),
- LocalHeader.Length, LocalHeader.Revision, LocalHeader.OemId,
- LocalHeader.OemTableId, LocalHeader.OemRevision,
- LocalHeader.AslCompilerId, LocalHeader.AslCompilerRevision));
- }
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiTbValidateChecksum
- *
- * PARAMETERS: Table - ACPI table to verify
- * Length - Length of entire table
- *
- * RETURN: Status
- *
- * DESCRIPTION: Verifies that the table checksums to zero. Optionally returns
- * exception on bad checksum.
- *
- ******************************************************************************/
-
-ACPI_STATUS
-AcpiTbVerifyChecksum (
- ACPI_TABLE_HEADER *Table,
- UINT32 Length)
-{
- UINT8 Checksum;
-
-
- /*
- * FACS/S3PT:
- * They are the odd tables, have no standard ACPI header and no checksum
- */
-
- if (ACPI_COMPARE_NAME (Table->Signature, ACPI_SIG_S3PT) ||
- ACPI_COMPARE_NAME (Table->Signature, ACPI_SIG_FACS))
- {
- return (AE_OK);
- }
-
- /* Compute the checksum on the table */
-
- Checksum = AcpiTbChecksum (ACPI_CAST_PTR (UINT8, Table), Length);
-
- /* Checksum ok? (should be zero) */
-
- if (Checksum)
- {
- ACPI_BIOS_WARNING ((AE_INFO,
- "Incorrect checksum in table [%4.4s] - 0x%2.2X, "
- "should be 0x%2.2X",
- Table->Signature, Table->Checksum,
- (UINT8) (Table->Checksum - Checksum)));
-
-#if (ACPI_CHECKSUM_ABORT)
- return (AE_BAD_CHECKSUM);
-#endif
- }
-
- return (AE_OK);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiTbChecksum
- *
- * PARAMETERS: Buffer - Pointer to memory region to be checked
- * Length - Length of this memory region
- *
- * RETURN: Checksum (UINT8)
- *
- * DESCRIPTION: Calculates circular checksum of memory region.
- *
- ******************************************************************************/
-
-UINT8
-AcpiTbChecksum (
- UINT8 *Buffer,
- UINT32 Length)
-{
- UINT8 Sum = 0;
- UINT8 *End = Buffer + Length;
-
-
- while (Buffer < End)
- {
- Sum = (UINT8) (Sum + *(Buffer++));
- }
-
- return (Sum);
-}
diff --git a/usr/src/uts/intel/io/acpica/tables/tbutils.c b/usr/src/uts/intel/io/acpica/tables/tbutils.c
deleted file mode 100644
index 5fc07b76e0..0000000000
--- a/usr/src/uts/intel/io/acpica/tables/tbutils.c
+++ /dev/null
@@ -1,413 +0,0 @@
-/******************************************************************************
- *
- * Module Name: tbutils - ACPI Table utilities
- *
- *****************************************************************************/
-
-/*
- * 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 "actables.h"
-
-#define _COMPONENT ACPI_TABLES
- ACPI_MODULE_NAME ("tbutils")
-
-
-/* Local prototypes */
-
-static ACPI_PHYSICAL_ADDRESS
-AcpiTbGetRootTableEntry (
- UINT8 *TableEntry,
- UINT32 TableEntrySize);
-
-
-#if (!ACPI_REDUCED_HARDWARE)
-/*******************************************************************************
- *
- * FUNCTION: AcpiTbInitializeFacs
- *
- * PARAMETERS: None
- *
- * RETURN: Status
- *
- * DESCRIPTION: Create a permanent mapping for the FADT and save it in a global
- * for accessing the Global Lock and Firmware Waking Vector
- *
- ******************************************************************************/
-
-ACPI_STATUS
-AcpiTbInitializeFacs (
- void)
-{
- ACPI_TABLE_FACS *Facs;
-
-
- /* If Hardware Reduced flag is set, there is no FACS */
-
- if (AcpiGbl_ReducedHardware)
- {
- AcpiGbl_FACS = NULL;
- return (AE_OK);
- }
- else if (AcpiGbl_FADT.XFacs &&
- (!AcpiGbl_FADT.Facs || !AcpiGbl_Use32BitFacsAddresses))
- {
- (void) AcpiGetTableByIndex (AcpiGbl_XFacsIndex,
- ACPI_CAST_INDIRECT_PTR (ACPI_TABLE_HEADER, &Facs));
- AcpiGbl_FACS = Facs;
- }
- else if (AcpiGbl_FADT.Facs)
- {
- (void) AcpiGetTableByIndex (AcpiGbl_FacsIndex,
- ACPI_CAST_INDIRECT_PTR (ACPI_TABLE_HEADER, &Facs));
- AcpiGbl_FACS = Facs;
- }
-
- /* If there is no FACS, just continue. There was already an error msg */
-
- return (AE_OK);
-}
-#endif /* !ACPI_REDUCED_HARDWARE */
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiTbCheckDsdtHeader
- *
- * PARAMETERS: None
- *
- * RETURN: None
- *
- * DESCRIPTION: Quick compare to check validity of the DSDT. This will detect
- * if the DSDT has been replaced from outside the OS and/or if
- * the DSDT header has been corrupted.
- *
- ******************************************************************************/
-
-void
-AcpiTbCheckDsdtHeader (
- void)
-{
-
- /* Compare original length and checksum to current values */
-
- if (AcpiGbl_OriginalDsdtHeader.Length != AcpiGbl_DSDT->Length ||
- AcpiGbl_OriginalDsdtHeader.Checksum != AcpiGbl_DSDT->Checksum)
- {
- ACPI_BIOS_ERROR ((AE_INFO,
- "The DSDT has been corrupted or replaced - "
- "old, new headers below"));
-
- AcpiTbPrintTableHeader (0, &AcpiGbl_OriginalDsdtHeader);
- AcpiTbPrintTableHeader (0, AcpiGbl_DSDT);
-
- /* Disable further error messages */
-
- AcpiGbl_OriginalDsdtHeader.Length = AcpiGbl_DSDT->Length;
- AcpiGbl_OriginalDsdtHeader.Checksum = AcpiGbl_DSDT->Checksum;
- }
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiTbCopyDsdt
- *
- * PARAMETERS: TableDesc - Installed table to copy
- *
- * RETURN: None
- *
- * DESCRIPTION: Implements a subsystem option to copy the DSDT to local memory.
- * Some very bad BIOSs are known to either corrupt the DSDT or
- * install a new, bad DSDT. This copy works around the problem.
- *
- ******************************************************************************/
-
-ACPI_TABLE_HEADER *
-AcpiTbCopyDsdt (
- UINT32 TableIndex)
-{
- ACPI_TABLE_HEADER *NewTable;
- ACPI_TABLE_DESC *TableDesc;
-
-
- TableDesc = &AcpiGbl_RootTableList.Tables[TableIndex];
-
- NewTable = ACPI_ALLOCATE (TableDesc->Length);
- if (!NewTable)
- {
- ACPI_ERROR ((AE_INFO, "Could not copy DSDT of length 0x%X",
- TableDesc->Length));
- return (NULL);
- }
-
- memcpy (NewTable, TableDesc->Pointer, TableDesc->Length);
- AcpiTbUninstallTable (TableDesc);
-
- AcpiTbInitTableDescriptor (
- &AcpiGbl_RootTableList.Tables[AcpiGbl_DsdtIndex],
- ACPI_PTR_TO_PHYSADDR (NewTable),
- ACPI_TABLE_ORIGIN_INTERNAL_VIRTUAL, NewTable);
-
- ACPI_INFO ((
- "Forced DSDT copy: length 0x%05X copied locally, original unmapped",
- NewTable->Length));
-
- return (NewTable);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiTbGetRootTableEntry
- *
- * PARAMETERS: TableEntry - Pointer to the RSDT/XSDT table entry
- * TableEntrySize - sizeof 32 or 64 (RSDT or XSDT)
- *
- * RETURN: Physical address extracted from the root table
- *
- * DESCRIPTION: Get one root table entry. Handles 32-bit and 64-bit cases on
- * both 32-bit and 64-bit platforms
- *
- * NOTE: ACPI_PHYSICAL_ADDRESS is 32-bit on 32-bit platforms, 64-bit on
- * 64-bit platforms.
- *
- ******************************************************************************/
-
-static ACPI_PHYSICAL_ADDRESS
-AcpiTbGetRootTableEntry (
- UINT8 *TableEntry,
- UINT32 TableEntrySize)
-{
- UINT64 Address64;
-
-
- /*
- * Get the table physical address (32-bit for RSDT, 64-bit for XSDT):
- * Note: Addresses are 32-bit aligned (not 64) in both RSDT and XSDT
- */
- if (TableEntrySize == ACPI_RSDT_ENTRY_SIZE)
- {
- /*
- * 32-bit platform, RSDT: Return 32-bit table entry
- * 64-bit platform, RSDT: Expand 32-bit to 64-bit and return
- */
- return ((ACPI_PHYSICAL_ADDRESS) (*ACPI_CAST_PTR (
- UINT32, TableEntry)));
- }
- else
- {
- /*
- * 32-bit platform, XSDT: Truncate 64-bit to 32-bit and return
- * 64-bit platform, XSDT: Move (unaligned) 64-bit to local,
- * return 64-bit
- */
- ACPI_MOVE_64_TO_64 (&Address64, TableEntry);
-
-#if ACPI_MACHINE_WIDTH == 32
- if (Address64 > ACPI_UINT32_MAX)
- {
- /* Will truncate 64-bit address to 32 bits, issue warning */
-
- ACPI_BIOS_WARNING ((AE_INFO,
- "64-bit Physical Address in XSDT is too large (0x%8.8X%8.8X),"
- " truncating",
- ACPI_FORMAT_UINT64 (Address64)));
- }
-#endif
- return ((ACPI_PHYSICAL_ADDRESS) (Address64));
- }
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiTbParseRootTable
- *
- * PARAMETERS: Rsdp - Pointer to the RSDP
- *
- * RETURN: Status
- *
- * DESCRIPTION: This function is called to parse the Root System Description
- * Table (RSDT or XSDT)
- *
- * NOTE: Tables are mapped (not copied) for efficiency. The FACS must
- * be mapped and cannot be copied because it contains the actual
- * memory location of the ACPI Global Lock.
- *
- ******************************************************************************/
-
-ACPI_STATUS
-AcpiTbParseRootTable (
- ACPI_PHYSICAL_ADDRESS RsdpAddress)
-{
- ACPI_TABLE_RSDP *Rsdp;
- UINT32 TableEntrySize;
- UINT32 i;
- UINT32 TableCount;
- ACPI_TABLE_HEADER *Table;
- ACPI_PHYSICAL_ADDRESS Address;
- UINT32 Length;
- UINT8 *TableEntry;
- ACPI_STATUS Status;
- UINT32 TableIndex;
-
-
- ACPI_FUNCTION_TRACE (TbParseRootTable);
-
-
- /* Map the entire RSDP and extract the address of the RSDT or XSDT */
-
- Rsdp = AcpiOsMapMemory (RsdpAddress, sizeof (ACPI_TABLE_RSDP));
- if (!Rsdp)
- {
- return_ACPI_STATUS (AE_NO_MEMORY);
- }
-
- AcpiTbPrintTableHeader (RsdpAddress,
- ACPI_CAST_PTR (ACPI_TABLE_HEADER, Rsdp));
-
- /* Use XSDT if present and not overridden. Otherwise, use RSDT */
-
- if ((Rsdp->Revision > 1) &&
- Rsdp->XsdtPhysicalAddress &&
- !AcpiGbl_DoNotUseXsdt)
- {
- /*
- * RSDP contains an XSDT (64-bit physical addresses). We must use
- * the XSDT if the revision is > 1 and the XSDT pointer is present,
- * as per the ACPI specification.
- */
- Address = (ACPI_PHYSICAL_ADDRESS) Rsdp->XsdtPhysicalAddress;
- TableEntrySize = ACPI_XSDT_ENTRY_SIZE;
- }
- else
- {
- /* Root table is an RSDT (32-bit physical addresses) */
-
- Address = (ACPI_PHYSICAL_ADDRESS) Rsdp->RsdtPhysicalAddress;
- TableEntrySize = ACPI_RSDT_ENTRY_SIZE;
- }
-
- /*
- * It is not possible to map more than one entry in some environments,
- * so unmap the RSDP here before mapping other tables
- */
- AcpiOsUnmapMemory (Rsdp, sizeof (ACPI_TABLE_RSDP));
-
- /* Map the RSDT/XSDT table header to get the full table length */
-
- Table = AcpiOsMapMemory (Address, sizeof (ACPI_TABLE_HEADER));
- if (!Table)
- {
- return_ACPI_STATUS (AE_NO_MEMORY);
- }
-
- AcpiTbPrintTableHeader (Address, Table);
-
- /*
- * Validate length of the table, and map entire table.
- * Minimum length table must contain at least one entry.
- */
- Length = Table->Length;
- AcpiOsUnmapMemory (Table, sizeof (ACPI_TABLE_HEADER));
-
- if (Length < (sizeof (ACPI_TABLE_HEADER) + TableEntrySize))
- {
- ACPI_BIOS_ERROR ((AE_INFO,
- "Invalid table length 0x%X in RSDT/XSDT", Length));
- return_ACPI_STATUS (AE_INVALID_TABLE_LENGTH);
- }
-
- Table = AcpiOsMapMemory (Address, Length);
- if (!Table)
- {
- return_ACPI_STATUS (AE_NO_MEMORY);
- }
-
- /* Validate the root table checksum */
-
- Status = AcpiTbVerifyChecksum (Table, Length);
- if (ACPI_FAILURE (Status))
- {
- AcpiOsUnmapMemory (Table, Length);
- return_ACPI_STATUS (Status);
- }
-
- /* Get the number of entries and pointer to first entry */
-
- TableCount = (UINT32) ((Table->Length - sizeof (ACPI_TABLE_HEADER)) /
- TableEntrySize);
- TableEntry = ACPI_ADD_PTR (UINT8, Table, sizeof (ACPI_TABLE_HEADER));
-
- /* Initialize the root table array from the RSDT/XSDT */
-
- for (i = 0; i < TableCount; i++)
- {
- /* Get the table physical address (32-bit for RSDT, 64-bit for XSDT) */
-
- Address = AcpiTbGetRootTableEntry (TableEntry, TableEntrySize);
-
- /* Skip NULL entries in RSDT/XSDT */
-
- if (!Address)
- {
- goto NextTable;
- }
-
- Status = AcpiTbInstallStandardTable (Address,
- ACPI_TABLE_ORIGIN_INTERNAL_PHYSICAL, FALSE, TRUE, &TableIndex);
-
- if (ACPI_SUCCESS (Status) &&
- ACPI_COMPARE_NAME (
- &AcpiGbl_RootTableList.Tables[TableIndex].Signature,
- ACPI_SIG_FADT))
- {
- AcpiGbl_FadtIndex = TableIndex;
- AcpiTbParseFadt ();
- }
-
-NextTable:
-
- TableEntry += TableEntrySize;
- }
-
- AcpiOsUnmapMemory (Table, Length);
- return_ACPI_STATUS (AE_OK);
-}
diff --git a/usr/src/uts/intel/io/acpica/tables/tbxface.c b/usr/src/uts/intel/io/acpica/tables/tbxface.c
deleted file mode 100644
index 8c0caaee75..0000000000
--- a/usr/src/uts/intel/io/acpica/tables/tbxface.c
+++ /dev/null
@@ -1,527 +0,0 @@
-/******************************************************************************
- *
- * Module Name: tbxface - ACPI table-oriented external interfaces
- *
- *****************************************************************************/
-
-/*
- * 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.
- */
-
-#define EXPORT_ACPI_INTERFACES
-
-#include "acpi.h"
-#include "accommon.h"
-#include "actables.h"
-
-#define _COMPONENT ACPI_TABLES
- ACPI_MODULE_NAME ("tbxface")
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiAllocateRootTable
- *
- * PARAMETERS: InitialTableCount - Size of InitialTableArray, in number of
- * ACPI_TABLE_DESC structures
- *
- * RETURN: Status
- *
- * DESCRIPTION: Allocate a root table array. Used by iASL compiler and
- * AcpiInitializeTables.
- *
- ******************************************************************************/
-
-ACPI_STATUS
-AcpiAllocateRootTable (
- UINT32 InitialTableCount)
-{
-
- AcpiGbl_RootTableList.MaxTableCount = InitialTableCount;
- AcpiGbl_RootTableList.Flags = ACPI_ROOT_ALLOW_RESIZE;
-
- return (AcpiTbResizeRootTableList ());
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiInitializeTables
- *
- * PARAMETERS: InitialTableArray - Pointer to an array of pre-allocated
- * ACPI_TABLE_DESC structures. If NULL, the
- * array is dynamically allocated.
- * InitialTableCount - Size of InitialTableArray, in number of
- * ACPI_TABLE_DESC structures
- * AllowResize - Flag to tell Table Manager if resize of
- * pre-allocated array is allowed. Ignored
- * if InitialTableArray is NULL.
- *
- * RETURN: Status
- *
- * DESCRIPTION: Initialize the table manager, get the RSDP and RSDT/XSDT.
- *
- * NOTE: Allows static allocation of the initial table array in order
- * to avoid the use of dynamic memory in confined environments
- * such as the kernel boot sequence where it may not be available.
- *
- * If the host OS memory managers are initialized, use NULL for
- * InitialTableArray, and the table will be dynamically allocated.
- *
- ******************************************************************************/
-
-ACPI_STATUS
-AcpiInitializeTables (
- ACPI_TABLE_DESC *InitialTableArray,
- UINT32 InitialTableCount,
- BOOLEAN AllowResize)
-{
- ACPI_PHYSICAL_ADDRESS RsdpAddress;
- ACPI_STATUS Status;
-
-
- ACPI_FUNCTION_TRACE (AcpiInitializeTables);
-
-
- /*
- * Setup the Root Table Array and allocate the table array
- * if requested
- */
- if (!InitialTableArray)
- {
- Status = AcpiAllocateRootTable (InitialTableCount);
- if (ACPI_FAILURE (Status))
- {
- return_ACPI_STATUS (Status);
- }
- }
- else
- {
- /* Root Table Array has been statically allocated by the host */
-
- memset (InitialTableArray, 0,
- (ACPI_SIZE) InitialTableCount * sizeof (ACPI_TABLE_DESC));
-
- AcpiGbl_RootTableList.Tables = InitialTableArray;
- AcpiGbl_RootTableList.MaxTableCount = InitialTableCount;
- AcpiGbl_RootTableList.Flags = ACPI_ROOT_ORIGIN_UNKNOWN;
- if (AllowResize)
- {
- AcpiGbl_RootTableList.Flags |= ACPI_ROOT_ALLOW_RESIZE;
- }
- }
-
- /* Get the address of the RSDP */
-
- RsdpAddress = AcpiOsGetRootPointer ();
- if (!RsdpAddress)
- {
- return_ACPI_STATUS (AE_NOT_FOUND);
- }
-
- /*
- * Get the root table (RSDT or XSDT) and extract all entries to the local
- * Root Table Array. This array contains the information of the RSDT/XSDT
- * in a common, more useable format.
- */
- Status = AcpiTbParseRootTable (RsdpAddress);
- return_ACPI_STATUS (Status);
-}
-
-ACPI_EXPORT_SYMBOL_INIT (AcpiInitializeTables)
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiReallocateRootTable
- *
- * PARAMETERS: None
- *
- * RETURN: Status
- *
- * DESCRIPTION: Reallocate Root Table List into dynamic memory. Copies the
- * root list from the previously provided scratch area. Should
- * be called once dynamic memory allocation is available in the
- * kernel.
- *
- ******************************************************************************/
-
-ACPI_STATUS
-AcpiReallocateRootTable (
- void)
-{
- ACPI_STATUS Status;
-
-
- ACPI_FUNCTION_TRACE (AcpiReallocateRootTable);
-
-
- /*
- * Only reallocate the root table if the host provided a static buffer
- * for the table array in the call to AcpiInitializeTables.
- */
- if (AcpiGbl_RootTableList.Flags & ACPI_ROOT_ORIGIN_ALLOCATED)
- {
- return_ACPI_STATUS (AE_SUPPORT);
- }
-
- AcpiGbl_RootTableList.Flags |= ACPI_ROOT_ALLOW_RESIZE;
-
- Status = AcpiTbResizeRootTableList ();
- return_ACPI_STATUS (Status);
-}
-
-ACPI_EXPORT_SYMBOL_INIT (AcpiReallocateRootTable)
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiGetTableHeader
- *
- * PARAMETERS: Signature - ACPI signature of needed table
- * Instance - Which instance (for SSDTs)
- * OutTableHeader - The pointer to the table header to fill
- *
- * RETURN: Status and pointer to mapped table header
- *
- * DESCRIPTION: Finds an ACPI table header.
- *
- * NOTE: Caller is responsible in unmapping the header with
- * AcpiOsUnmapMemory
- *
- ******************************************************************************/
-
-ACPI_STATUS
-AcpiGetTableHeader (
- char *Signature,
- UINT32 Instance,
- ACPI_TABLE_HEADER *OutTableHeader)
-{
- UINT32 i;
- UINT32 j;
- ACPI_TABLE_HEADER *Header;
-
-
- /* Parameter validation */
-
- if (!Signature || !OutTableHeader)
- {
- return (AE_BAD_PARAMETER);
- }
-
- /* Walk the root table list */
-
- for (i = 0, j = 0; i < AcpiGbl_RootTableList.CurrentTableCount; i++)
- {
- if (!ACPI_COMPARE_NAME (
- &(AcpiGbl_RootTableList.Tables[i].Signature), Signature))
- {
- continue;
- }
-
- if (++j < Instance)
- {
- continue;
- }
-
- if (!AcpiGbl_RootTableList.Tables[i].Pointer)
- {
- if ((AcpiGbl_RootTableList.Tables[i].Flags &
- ACPI_TABLE_ORIGIN_MASK) ==
- ACPI_TABLE_ORIGIN_INTERNAL_PHYSICAL)
- {
- Header = AcpiOsMapMemory (
- AcpiGbl_RootTableList.Tables[i].Address,
- sizeof (ACPI_TABLE_HEADER));
- if (!Header)
- {
- return (AE_NO_MEMORY);
- }
-
- memcpy (OutTableHeader, Header, sizeof (ACPI_TABLE_HEADER));
- AcpiOsUnmapMemory (Header, sizeof (ACPI_TABLE_HEADER));
- }
- else
- {
- return (AE_NOT_FOUND);
- }
- }
- else
- {
- memcpy (OutTableHeader,
- AcpiGbl_RootTableList.Tables[i].Pointer,
- sizeof (ACPI_TABLE_HEADER));
- }
-
- return (AE_OK);
- }
-
- return (AE_NOT_FOUND);
-}
-
-ACPI_EXPORT_SYMBOL (AcpiGetTableHeader)
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiGetTable
- *
- * PARAMETERS: Signature - ACPI signature of needed table
- * Instance - Which instance (for SSDTs)
- * OutTable - Where the pointer to the table is returned
- *
- * RETURN: Status and pointer to the requested table
- *
- * DESCRIPTION: Finds and verifies an ACPI table. Table must be in the
- * RSDT/XSDT.
- *
- ******************************************************************************/
-
-ACPI_STATUS
-AcpiGetTable (
- char *Signature,
- UINT32 Instance,
- ACPI_TABLE_HEADER **OutTable)
-{
- UINT32 i;
- UINT32 j;
- ACPI_STATUS Status;
-
-
- /* Parameter validation */
-
- if (!Signature || !OutTable)
- {
- return (AE_BAD_PARAMETER);
- }
-
- /* Walk the root table list */
-
- for (i = 0, j = 0; i < AcpiGbl_RootTableList.CurrentTableCount; i++)
- {
- if (!ACPI_COMPARE_NAME (
- &(AcpiGbl_RootTableList.Tables[i].Signature), Signature))
- {
- continue;
- }
-
- if (++j < Instance)
- {
- continue;
- }
-
- Status = AcpiTbValidateTable (&AcpiGbl_RootTableList.Tables[i]);
- if (ACPI_SUCCESS (Status))
- {
- *OutTable = AcpiGbl_RootTableList.Tables[i].Pointer;
- }
-
- return (Status);
- }
-
- return (AE_NOT_FOUND);
-}
-
-ACPI_EXPORT_SYMBOL (AcpiGetTable)
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiGetTableByIndex
- *
- * PARAMETERS: TableIndex - Table index
- * Table - Where the pointer to the table is returned
- *
- * RETURN: Status and pointer to the requested table
- *
- * DESCRIPTION: Obtain a table by an index into the global table list. Used
- * internally also.
- *
- ******************************************************************************/
-
-ACPI_STATUS
-AcpiGetTableByIndex (
- UINT32 TableIndex,
- ACPI_TABLE_HEADER **Table)
-{
- ACPI_STATUS Status;
-
-
- ACPI_FUNCTION_TRACE (AcpiGetTableByIndex);
-
-
- /* Parameter validation */
-
- if (!Table)
- {
- return_ACPI_STATUS (AE_BAD_PARAMETER);
- }
-
- (void) AcpiUtAcquireMutex (ACPI_MTX_TABLES);
-
- /* Validate index */
-
- if (TableIndex >= AcpiGbl_RootTableList.CurrentTableCount)
- {
- (void) AcpiUtReleaseMutex (ACPI_MTX_TABLES);
- return_ACPI_STATUS (AE_BAD_PARAMETER);
- }
-
- if (!AcpiGbl_RootTableList.Tables[TableIndex].Pointer)
- {
- /* Table is not mapped, map it */
-
- Status = AcpiTbValidateTable (
- &AcpiGbl_RootTableList.Tables[TableIndex]);
- if (ACPI_FAILURE (Status))
- {
- (void) AcpiUtReleaseMutex (ACPI_MTX_TABLES);
- return_ACPI_STATUS (Status);
- }
- }
-
- *Table = AcpiGbl_RootTableList.Tables[TableIndex].Pointer;
- (void) AcpiUtReleaseMutex (ACPI_MTX_TABLES);
- return_ACPI_STATUS (AE_OK);
-}
-
-ACPI_EXPORT_SYMBOL (AcpiGetTableByIndex)
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiInstallTableHandler
- *
- * PARAMETERS: Handler - Table event handler
- * Context - Value passed to the handler on each event
- *
- * RETURN: Status
- *
- * DESCRIPTION: Install a global table event handler.
- *
- ******************************************************************************/
-
-ACPI_STATUS
-AcpiInstallTableHandler (
- ACPI_TABLE_HANDLER Handler,
- void *Context)
-{
- ACPI_STATUS Status;
-
-
- ACPI_FUNCTION_TRACE (AcpiInstallTableHandler);
-
-
- if (!Handler)
- {
- return_ACPI_STATUS (AE_BAD_PARAMETER);
- }
-
- Status = AcpiUtAcquireMutex (ACPI_MTX_EVENTS);
- if (ACPI_FAILURE (Status))
- {
- return_ACPI_STATUS (Status);
- }
-
- /* Don't allow more than one handler */
-
- if (AcpiGbl_TableHandler)
- {
- Status = AE_ALREADY_EXISTS;
- goto Cleanup;
- }
-
- /* Install the handler */
-
- AcpiGbl_TableHandler = Handler;
- AcpiGbl_TableHandlerContext = Context;
-
-Cleanup:
- (void) AcpiUtReleaseMutex (ACPI_MTX_EVENTS);
- return_ACPI_STATUS (Status);
-}
-
-ACPI_EXPORT_SYMBOL (AcpiInstallTableHandler)
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiRemoveTableHandler
- *
- * PARAMETERS: Handler - Table event handler that was installed
- * previously.
- *
- * RETURN: Status
- *
- * DESCRIPTION: Remove a table event handler
- *
- ******************************************************************************/
-
-ACPI_STATUS
-AcpiRemoveTableHandler (
- ACPI_TABLE_HANDLER Handler)
-{
- ACPI_STATUS Status;
-
-
- ACPI_FUNCTION_TRACE (AcpiRemoveTableHandler);
-
-
- Status = AcpiUtAcquireMutex (ACPI_MTX_EVENTS);
- if (ACPI_FAILURE (Status))
- {
- return_ACPI_STATUS (Status);
- }
-
- /* Make sure that the installed handler is the same */
-
- if (!Handler ||
- Handler != AcpiGbl_TableHandler)
- {
- Status = AE_BAD_PARAMETER;
- goto Cleanup;
- }
-
- /* Remove the handler */
-
- AcpiGbl_TableHandler = NULL;
-
-Cleanup:
- (void) AcpiUtReleaseMutex (ACPI_MTX_EVENTS);
- return_ACPI_STATUS (Status);
-}
-
-ACPI_EXPORT_SYMBOL (AcpiRemoveTableHandler)
diff --git a/usr/src/uts/intel/io/acpica/tables/tbxfload.c b/usr/src/uts/intel/io/acpica/tables/tbxfload.c
deleted file mode 100644
index 645b9d57ac..0000000000
--- a/usr/src/uts/intel/io/acpica/tables/tbxfload.c
+++ /dev/null
@@ -1,538 +0,0 @@
-/******************************************************************************
- *
- * Module Name: tbxfload - Table load/unload external interfaces
- *
- *****************************************************************************/
-
-/*
- * 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.
- */
-
-#define EXPORT_ACPI_INTERFACES
-
-#include "acpi.h"
-#include "accommon.h"
-#include "acnamesp.h"
-#include "actables.h"
-#include "acevents.h"
-
-#define _COMPONENT ACPI_TABLES
- ACPI_MODULE_NAME ("tbxfload")
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiLoadTables
- *
- * PARAMETERS: None
- *
- * RETURN: Status
- *
- * DESCRIPTION: Load the ACPI tables from the RSDT/XSDT
- *
- ******************************************************************************/
-
-ACPI_STATUS
-AcpiLoadTables (
- void)
-{
- ACPI_STATUS Status;
-
-
- ACPI_FUNCTION_TRACE (AcpiLoadTables);
-
-
- /*
- * Install the default operation region handlers. These are the
- * handlers that are defined by the ACPI specification to be
- * "always accessible" -- namely, SystemMemory, SystemIO, and
- * PCI_Config. This also means that no _REG methods need to be
- * run for these address spaces. We need to have these handlers
- * installed before any AML code can be executed, especially any
- * module-level code (11/2015).
- * Note that we allow OSPMs to install their own region handlers
- * between AcpiInitializeSubsystem() and AcpiLoadTables() to use
- * their customized default region handlers.
- */
- Status = AcpiEvInstallRegionHandlers ();
- if (ACPI_FAILURE (Status))
- {
- ACPI_EXCEPTION ((AE_INFO, Status, "During Region initialization"));
- return_ACPI_STATUS (Status);
- }
-
- /* Load the namespace from the tables */
-
- Status = AcpiTbLoadNamespace ();
-
- /* Don't let single failures abort the load */
-
- if (Status == AE_CTRL_TERMINATE)
- {
- Status = AE_OK;
- }
-
- if (ACPI_FAILURE (Status))
- {
- ACPI_EXCEPTION ((AE_INFO, Status,
- "While loading namespace from ACPI tables"));
- }
-
- if (!AcpiGbl_GroupModuleLevelCode)
- {
- /*
- * Initialize the objects that remain uninitialized. This
- * runs the executable AML that may be part of the
- * declaration of these objects:
- * OperationRegions, BufferFields, Buffers, and Packages.
- */
- Status = AcpiNsInitializeObjects ();
- if (ACPI_FAILURE (Status))
- {
- return_ACPI_STATUS (Status);
- }
- }
-
- AcpiGbl_NamespaceInitialized = TRUE;
- return_ACPI_STATUS (Status);
-}
-
-ACPI_EXPORT_SYMBOL_INIT (AcpiLoadTables)
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiTbLoadNamespace
- *
- * PARAMETERS: None
- *
- * RETURN: Status
- *
- * DESCRIPTION: Load the namespace from the DSDT and all SSDTs/PSDTs found in
- * the RSDT/XSDT.
- *
- ******************************************************************************/
-
-ACPI_STATUS
-AcpiTbLoadNamespace (
- void)
-{
- ACPI_STATUS Status;
- UINT32 i;
- ACPI_TABLE_HEADER *NewDsdt;
- ACPI_TABLE_DESC *Table;
- UINT32 TablesLoaded = 0;
- UINT32 TablesFailed = 0;
-
-
- ACPI_FUNCTION_TRACE (TbLoadNamespace);
-
-
- (void) AcpiUtAcquireMutex (ACPI_MTX_TABLES);
-
- /*
- * Load the namespace. The DSDT is required, but any SSDT and
- * PSDT tables are optional. Verify the DSDT.
- */
- Table = &AcpiGbl_RootTableList.Tables[AcpiGbl_DsdtIndex];
-
- if (!AcpiGbl_RootTableList.CurrentTableCount ||
- !ACPI_COMPARE_NAME (Table->Signature.Ascii, ACPI_SIG_DSDT) ||
- ACPI_FAILURE (AcpiTbValidateTable (Table)))
- {
- Status = AE_NO_ACPI_TABLES;
- goto UnlockAndExit;
- }
-
- /*
- * Save the DSDT pointer for simple access. This is the mapped memory
- * address. We must take care here because the address of the .Tables
- * array can change dynamically as tables are loaded at run-time. Note:
- * .Pointer field is not validated until after call to AcpiTbValidateTable.
- */
- AcpiGbl_DSDT = Table->Pointer;
-
- /*
- * Optionally copy the entire DSDT to local memory (instead of simply
- * mapping it.) There are some BIOSs that corrupt or replace the original
- * DSDT, creating the need for this option. Default is FALSE, do not copy
- * the DSDT.
- */
- if (AcpiGbl_CopyDsdtLocally)
- {
- NewDsdt = AcpiTbCopyDsdt (AcpiGbl_DsdtIndex);
- if (NewDsdt)
- {
- AcpiGbl_DSDT = NewDsdt;
- }
- }
-
- /*
- * Save the original DSDT header for detection of table corruption
- * and/or replacement of the DSDT from outside the OS.
- */
- memcpy (&AcpiGbl_OriginalDsdtHeader, AcpiGbl_DSDT,
- sizeof (ACPI_TABLE_HEADER));
-
- (void) AcpiUtReleaseMutex (ACPI_MTX_TABLES);
-
- /* Load and parse tables */
-
- Status = AcpiNsLoadTable (AcpiGbl_DsdtIndex, AcpiGbl_RootNode);
- if (ACPI_FAILURE (Status))
- {
- ACPI_EXCEPTION ((AE_INFO, Status, "[DSDT] table load failed"));
- TablesFailed++;
- }
- else
- {
- TablesLoaded++;
- }
-
- /* Load any SSDT or PSDT tables. Note: Loop leaves tables locked */
-
- (void) AcpiUtAcquireMutex (ACPI_MTX_TABLES);
- for (i = 0; i < AcpiGbl_RootTableList.CurrentTableCount; ++i)
- {
- Table = &AcpiGbl_RootTableList.Tables[i];
-
- if (!AcpiGbl_RootTableList.Tables[i].Address ||
- (!ACPI_COMPARE_NAME (Table->Signature.Ascii, ACPI_SIG_SSDT) &&
- !ACPI_COMPARE_NAME (Table->Signature.Ascii, ACPI_SIG_PSDT) &&
- !ACPI_COMPARE_NAME (Table->Signature.Ascii, ACPI_SIG_OSDT)) ||
- ACPI_FAILURE (AcpiTbValidateTable (Table)))
- {
- continue;
- }
-
- /* Ignore errors while loading tables, get as many as possible */
-
- (void) AcpiUtReleaseMutex (ACPI_MTX_TABLES);
- Status = AcpiNsLoadTable (i, AcpiGbl_RootNode);
- if (ACPI_FAILURE (Status))
- {
- ACPI_EXCEPTION ((AE_INFO, Status, "(%4.4s:%8.8s) while loading table",
- Table->Signature.Ascii, Table->Pointer->OemTableId));
-
- TablesFailed++;
-
- ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT,
- "Table [%4.4s:%8.8s] (id FF) - Table namespace load failed\n\n",
- Table->Signature.Ascii, Table->Pointer->OemTableId));
- }
- else
- {
- TablesLoaded++;
- }
-
- (void) AcpiUtAcquireMutex (ACPI_MTX_TABLES);
- }
-
- if (!TablesFailed)
- {
- ACPI_INFO ((
- "%u ACPI AML tables successfully acquired and loaded\n",
- TablesLoaded));
- }
- else
- {
- ACPI_ERROR ((AE_INFO,
- "%u table load failures, %u successful",
- TablesFailed, TablesLoaded));
-
- /* Indicate at least one failure */
-
- Status = AE_CTRL_TERMINATE;
- }
-
-UnlockAndExit:
- (void) AcpiUtReleaseMutex (ACPI_MTX_TABLES);
- return_ACPI_STATUS (Status);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiInstallTable
- *
- * PARAMETERS: Address - Address of the ACPI table to be installed.
- * Physical - Whether the address is a physical table
- * address or not
- *
- * RETURN: Status
- *
- * DESCRIPTION: Dynamically install an ACPI table.
- * Note: This function should only be invoked after
- * AcpiInitializeTables() and before AcpiLoadTables().
- *
- ******************************************************************************/
-
-ACPI_STATUS
-AcpiInstallTable (
- ACPI_PHYSICAL_ADDRESS Address,
- BOOLEAN Physical)
-{
- ACPI_STATUS Status;
- UINT8 Flags;
- UINT32 TableIndex;
-
-
- ACPI_FUNCTION_TRACE (AcpiInstallTable);
-
-
- if (Physical)
- {
- Flags = ACPI_TABLE_ORIGIN_INTERNAL_PHYSICAL;
- }
- else
- {
- Flags = ACPI_TABLE_ORIGIN_EXTERNAL_VIRTUAL;
- }
-
- Status = AcpiTbInstallStandardTable (Address, Flags,
- FALSE, FALSE, &TableIndex);
-
- return_ACPI_STATUS (Status);
-}
-
-ACPI_EXPORT_SYMBOL_INIT (AcpiInstallTable)
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiLoadTable
- *
- * PARAMETERS: Table - Pointer to a buffer containing the ACPI
- * table to be loaded.
- *
- * RETURN: Status
- *
- * DESCRIPTION: Dynamically load an ACPI table from the caller's buffer. Must
- * be a valid ACPI table with a valid ACPI table header.
- * Note1: Mainly intended to support hotplug addition of SSDTs.
- * Note2: Does not copy the incoming table. User is responsible
- * to ensure that the table is not deleted or unmapped.
- *
- ******************************************************************************/
-
-ACPI_STATUS
-AcpiLoadTable (
- ACPI_TABLE_HEADER *Table)
-{
- ACPI_STATUS Status;
- UINT32 TableIndex;
-
-
- ACPI_FUNCTION_TRACE (AcpiLoadTable);
-
-
- /* Parameter validation */
-
- if (!Table)
- {
- return_ACPI_STATUS (AE_BAD_PARAMETER);
- }
-
- /* Must acquire the interpreter lock during this operation */
-
- Status = AcpiUtAcquireMutex (ACPI_MTX_INTERPRETER);
- if (ACPI_FAILURE (Status))
- {
- return_ACPI_STATUS (Status);
- }
-
- /* Install the table and load it into the namespace */
-
- ACPI_INFO (("Host-directed Dynamic ACPI Table Load:"));
- (void) AcpiUtAcquireMutex (ACPI_MTX_TABLES);
-
- Status = AcpiTbInstallStandardTable (ACPI_PTR_TO_PHYSADDR (Table),
- ACPI_TABLE_ORIGIN_EXTERNAL_VIRTUAL, TRUE, FALSE,
- &TableIndex);
-
- (void) AcpiUtReleaseMutex (ACPI_MTX_TABLES);
- if (ACPI_FAILURE (Status))
- {
- goto UnlockAndExit;
- }
-
- /*
- * Note: Now table is "INSTALLED", it must be validated before
- * using.
- */
- Status = AcpiTbValidateTable (
- &AcpiGbl_RootTableList.Tables[TableIndex]);
- if (ACPI_FAILURE (Status))
- {
- goto UnlockAndExit;
- }
-
- Status = AcpiNsLoadTable (TableIndex, AcpiGbl_RootNode);
-
- /* Invoke table handler if present */
-
- if (AcpiGbl_TableHandler)
- {
- (void) AcpiGbl_TableHandler (ACPI_TABLE_EVENT_LOAD, Table,
- AcpiGbl_TableHandlerContext);
- }
-
-UnlockAndExit:
- (void) AcpiUtReleaseMutex (ACPI_MTX_INTERPRETER);
- return_ACPI_STATUS (Status);
-}
-
-ACPI_EXPORT_SYMBOL (AcpiLoadTable)
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiUnloadParentTable
- *
- * PARAMETERS: Object - Handle to any namespace object owned by
- * the table to be unloaded
- *
- * RETURN: Status
- *
- * DESCRIPTION: Via any namespace object within an SSDT or OEMx table, unloads
- * the table and deletes all namespace objects associated with
- * that table. Unloading of the DSDT is not allowed.
- * Note: Mainly intended to support hotplug removal of SSDTs.
- *
- ******************************************************************************/
-
-ACPI_STATUS
-AcpiUnloadParentTable (
- ACPI_HANDLE Object)
-{
- ACPI_NAMESPACE_NODE *Node = ACPI_CAST_PTR (ACPI_NAMESPACE_NODE, Object);
- ACPI_STATUS Status = AE_NOT_EXIST;
- ACPI_OWNER_ID OwnerId;
- UINT32 i;
-
-
- ACPI_FUNCTION_TRACE (AcpiUnloadParentTable);
-
-
- /* Parameter validation */
-
- if (!Object)
- {
- return_ACPI_STATUS (AE_BAD_PARAMETER);
- }
-
- /*
- * The node OwnerId is currently the same as the parent table ID.
- * However, this could change in the future.
- */
- OwnerId = Node->OwnerId;
- if (!OwnerId)
- {
- /* OwnerId==0 means DSDT is the owner. DSDT cannot be unloaded */
-
- return_ACPI_STATUS (AE_TYPE);
- }
-
- /* Must acquire the interpreter lock during this operation */
-
- Status = AcpiUtAcquireMutex (ACPI_MTX_INTERPRETER);
- if (ACPI_FAILURE (Status))
- {
- return_ACPI_STATUS (Status);
- }
-
- /* Find the table in the global table list */
-
- for (i = 0; i < AcpiGbl_RootTableList.CurrentTableCount; i++)
- {
- if (OwnerId != AcpiGbl_RootTableList.Tables[i].OwnerId)
- {
- continue;
- }
-
- /*
- * Allow unload of SSDT and OEMx tables only. Do not allow unload
- * of the DSDT. No other types of tables should get here, since
- * only these types can contain AML and thus are the only types
- * that can create namespace objects.
- */
- if (ACPI_COMPARE_NAME (
- AcpiGbl_RootTableList.Tables[i].Signature.Ascii,
- ACPI_SIG_DSDT))
- {
- Status = AE_TYPE;
- break;
- }
-
- /* Ensure the table is actually loaded */
-
- if (!AcpiTbIsTableLoaded (i))
- {
- Status = AE_NOT_EXIST;
- break;
- }
-
- /* Invoke table handler if present */
-
- if (AcpiGbl_TableHandler)
- {
- (void) AcpiGbl_TableHandler (ACPI_TABLE_EVENT_UNLOAD,
- AcpiGbl_RootTableList.Tables[i].Pointer,
- AcpiGbl_TableHandlerContext);
- }
-
- /*
- * Delete all namespace objects owned by this table. Note that
- * these objects can appear anywhere in the namespace by virtue
- * of the AML "Scope" operator. Thus, we need to track ownership
- * by an ID, not simply a position within the hierarchy.
- */
- Status = AcpiTbDeleteNamespaceByOwner (i);
- if (ACPI_FAILURE (Status))
- {
- break;
- }
-
- Status = AcpiTbReleaseOwnerId (i);
- AcpiTbSetTableLoadedFlag (i, FALSE);
- break;
- }
-
- (void) AcpiUtReleaseMutex (ACPI_MTX_INTERPRETER);
- return_ACPI_STATUS (Status);
-}
-
-ACPI_EXPORT_SYMBOL (AcpiUnloadParentTable)
diff --git a/usr/src/uts/intel/io/acpica/tables/tbxfroot.c b/usr/src/uts/intel/io/acpica/tables/tbxfroot.c
deleted file mode 100644
index aaa24c470f..0000000000
--- a/usr/src/uts/intel/io/acpica/tables/tbxfroot.c
+++ /dev/null
@@ -1,323 +0,0 @@
-/******************************************************************************
- *
- * Module Name: tbxfroot - Find the root ACPI table (RSDT)
- *
- *****************************************************************************/
-
-/*
- * 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 "actables.h"
-
-
-#define _COMPONENT ACPI_TABLES
- ACPI_MODULE_NAME ("tbxfroot")
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiTbGetRsdpLength
- *
- * PARAMETERS: Rsdp - Pointer to RSDP
- *
- * RETURN: Table length
- *
- * DESCRIPTION: Get the length of the RSDP
- *
- ******************************************************************************/
-
-UINT32
-AcpiTbGetRsdpLength (
- ACPI_TABLE_RSDP *Rsdp)
-{
-
- if (!ACPI_VALIDATE_RSDP_SIG (Rsdp->Signature))
- {
- /* BAD Signature */
-
- return (0);
- }
-
- /* "Length" field is available if table version >= 2 */
-
- if (Rsdp->Revision >= 2)
- {
- return (Rsdp->Length);
- }
- else
- {
- return (ACPI_RSDP_CHECKSUM_LENGTH);
- }
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiTbValidateRsdp
- *
- * PARAMETERS: Rsdp - Pointer to unvalidated RSDP
- *
- * RETURN: Status
- *
- * DESCRIPTION: Validate the RSDP (ptr)
- *
- ******************************************************************************/
-
-ACPI_STATUS
-AcpiTbValidateRsdp (
- ACPI_TABLE_RSDP *Rsdp)
-{
-
- /*
- * The signature and checksum must both be correct
- *
- * Note: Sometimes there exists more than one RSDP in memory; the valid
- * RSDP has a valid checksum, all others have an invalid checksum.
- */
- if (!ACPI_VALIDATE_RSDP_SIG (Rsdp->Signature))
- {
- /* Nope, BAD Signature */
-
- return (AE_BAD_SIGNATURE);
- }
-
- /* Check the standard checksum */
-
- if (AcpiTbChecksum ((UINT8 *) Rsdp, ACPI_RSDP_CHECKSUM_LENGTH) != 0)
- {
- return (AE_BAD_CHECKSUM);
- }
-
- /* Check extended checksum if table version >= 2 */
-
- if ((Rsdp->Revision >= 2) &&
- (AcpiTbChecksum ((UINT8 *) Rsdp, ACPI_RSDP_XCHECKSUM_LENGTH) != 0))
- {
- return (AE_BAD_CHECKSUM);
- }
-
- return (AE_OK);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiFindRootPointer
- *
- * PARAMETERS: TableAddress - Where the table pointer is returned
- *
- * RETURN: Status, RSDP physical address
- *
- * DESCRIPTION: Search lower 1Mbyte of memory for the root system descriptor
- * pointer structure. If it is found, set *RSDP to point to it.
- *
- * NOTE1: The RSDP must be either in the first 1K of the Extended
- * BIOS Data Area or between E0000 and FFFFF (From ACPI Spec.)
- * Only a 32-bit physical address is necessary.
- *
- * NOTE2: This function is always available, regardless of the
- * initialization state of the rest of ACPI.
- *
- ******************************************************************************/
-
-ACPI_STATUS
-AcpiFindRootPointer (
- ACPI_PHYSICAL_ADDRESS *TableAddress)
-{
- UINT8 *TablePtr;
- UINT8 *MemRover;
- UINT32 PhysicalAddress;
-
-
- ACPI_FUNCTION_TRACE (AcpiFindRootPointer);
-
-
- /* 1a) Get the location of the Extended BIOS Data Area (EBDA) */
-
- TablePtr = AcpiOsMapMemory (
- (ACPI_PHYSICAL_ADDRESS) ACPI_EBDA_PTR_LOCATION,
- ACPI_EBDA_PTR_LENGTH);
- if (!TablePtr)
- {
- ACPI_ERROR ((AE_INFO,
- "Could not map memory at 0x%8.8X for length %u",
- ACPI_EBDA_PTR_LOCATION, ACPI_EBDA_PTR_LENGTH));
-
- return_ACPI_STATUS (AE_NO_MEMORY);
- }
-
- ACPI_MOVE_16_TO_32 (&PhysicalAddress, TablePtr);
-
- /* Convert segment part to physical address */
-
- PhysicalAddress <<= 4;
- AcpiOsUnmapMemory (TablePtr, ACPI_EBDA_PTR_LENGTH);
-
- /* EBDA present? */
-
- if (PhysicalAddress > 0x400)
- {
- /*
- * 1b) Search EBDA paragraphs (EBDA is required to be a
- * minimum of 1K length)
- */
- TablePtr = AcpiOsMapMemory (
- (ACPI_PHYSICAL_ADDRESS) PhysicalAddress,
- ACPI_EBDA_WINDOW_SIZE);
- if (!TablePtr)
- {
- ACPI_ERROR ((AE_INFO,
- "Could not map memory at 0x%8.8X for length %u",
- PhysicalAddress, ACPI_EBDA_WINDOW_SIZE));
-
- return_ACPI_STATUS (AE_NO_MEMORY);
- }
-
- MemRover = AcpiTbScanMemoryForRsdp (
- TablePtr, ACPI_EBDA_WINDOW_SIZE);
- AcpiOsUnmapMemory (TablePtr, ACPI_EBDA_WINDOW_SIZE);
-
- if (MemRover)
- {
- /* Return the physical address */
-
- PhysicalAddress +=
- (UINT32) ACPI_PTR_DIFF (MemRover, TablePtr);
-
- *TableAddress = (ACPI_PHYSICAL_ADDRESS) PhysicalAddress;
- return_ACPI_STATUS (AE_OK);
- }
- }
-
- /*
- * 2) Search upper memory: 16-byte boundaries in E0000h-FFFFFh
- */
- TablePtr = AcpiOsMapMemory (
- (ACPI_PHYSICAL_ADDRESS) ACPI_HI_RSDP_WINDOW_BASE,
- ACPI_HI_RSDP_WINDOW_SIZE);
-
- if (!TablePtr)
- {
- ACPI_ERROR ((AE_INFO,
- "Could not map memory at 0x%8.8X for length %u",
- ACPI_HI_RSDP_WINDOW_BASE, ACPI_HI_RSDP_WINDOW_SIZE));
-
- return_ACPI_STATUS (AE_NO_MEMORY);
- }
-
- MemRover = AcpiTbScanMemoryForRsdp (
- TablePtr, ACPI_HI_RSDP_WINDOW_SIZE);
- AcpiOsUnmapMemory (TablePtr, ACPI_HI_RSDP_WINDOW_SIZE);
-
- if (MemRover)
- {
- /* Return the physical address */
-
- PhysicalAddress = (UINT32)
- (ACPI_HI_RSDP_WINDOW_BASE + ACPI_PTR_DIFF (MemRover, TablePtr));
-
- *TableAddress = (ACPI_PHYSICAL_ADDRESS) PhysicalAddress;
- return_ACPI_STATUS (AE_OK);
- }
-
- /* A valid RSDP was not found */
-
- ACPI_BIOS_ERROR ((AE_INFO, "A valid RSDP was not found"));
- return_ACPI_STATUS (AE_NOT_FOUND);
-}
-
-ACPI_EXPORT_SYMBOL (AcpiFindRootPointer)
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiTbScanMemoryForRsdp
- *
- * PARAMETERS: StartAddress - Starting pointer for search
- * Length - Maximum length to search
- *
- * RETURN: Pointer to the RSDP if found, otherwise NULL.
- *
- * DESCRIPTION: Search a block of memory for the RSDP signature
- *
- ******************************************************************************/
-
-UINT8 *
-AcpiTbScanMemoryForRsdp (
- UINT8 *StartAddress,
- UINT32 Length)
-{
- ACPI_STATUS Status;
- UINT8 *MemRover;
- UINT8 *EndAddress;
-
-
- ACPI_FUNCTION_TRACE (TbScanMemoryForRsdp);
-
-
- EndAddress = StartAddress + Length;
-
- /* Search from given start address for the requested length */
-
- for (MemRover = StartAddress; MemRover < EndAddress;
- MemRover += ACPI_RSDP_SCAN_STEP)
- {
- /* The RSDP signature and checksum must both be correct */
-
- Status = AcpiTbValidateRsdp (
- ACPI_CAST_PTR (ACPI_TABLE_RSDP, MemRover));
- if (ACPI_SUCCESS (Status))
- {
- /* Sig and checksum valid, we have found a real RSDP */
-
- ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
- "RSDP located at physical address %p\n", MemRover));
- return_PTR (MemRover);
- }
-
- /* No sig match or bad checksum, keep searching */
- }
-
- /* Searched entire block, no RSDP was found */
-
- ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
- "Searched entire block from %p, valid RSDP was not found\n",
- StartAddress));
- return_PTR (NULL);
-}