/******************************************************************************
*
* 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"
ACPI_MODULE_NAME ("tbutils")
/* Local prototypes */
static ACPI_PHYSICAL_ADDRESS
#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
*
******************************************************************************/
void)
{
/* If Hardware Reduced flag is set, there is no FACS */
{
AcpiGbl_FACS = NULL;
return (AE_OK);
}
else if (AcpiGbl_FADT.XFacs &&
{
(void) AcpiGetTableByIndex (AcpiGbl_XFacsIndex,
AcpiGbl_FACS = Facs;
}
else if (AcpiGbl_FADT.Facs)
{
(void) AcpiGetTableByIndex (AcpiGbl_FacsIndex,
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
* the DSDT header has been corrupted.
*
******************************************************************************/
void
void)
{
/* Compare original length and checksum to current values */
{
"The DSDT has been corrupted or replaced - "
"old, new headers below"));
/* Disable further error messages */
}
}
/*******************************************************************************
*
* 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.
*
******************************************************************************/
{
if (!NewTable)
{
return (NULL);
}
ACPI_INFO ((
"Forced DSDT copy: length 0x%05X copied locally, original unmapped",
return (NewTable);
}
/*******************************************************************************
*
* FUNCTION: AcpiTbGetRootTableEntry
*
* 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
{
/*
* 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
*/
#if ACPI_MACHINE_WIDTH == 32
if (Address64 > ACPI_UINT32_MAX)
{
/* Will truncate 64-bit address to 32 bits, issue warning */
"64-bit Physical Address in XSDT is too large (0x%8.8X%8.8X),"
" truncating",
}
#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.
*
******************************************************************************/
{
UINT32 i;
/* Map the entire RSDP and extract the address of the RSDT or XSDT */
if (!Rsdp)
{
}
/* Use XSDT if present and not overridden. Otherwise, use RSDT */
{
/*
* 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.
*/
}
else
{
/* Root table is an RSDT (32-bit physical addresses) */
}
/*
* It is not possible to map more than one entry in some environments,
* so unmap the RSDP here before mapping other tables
*/
if (!Table)
{
}
/*
* Validate length of the table, and map entire table.
* Minimum length table must contain at least one entry.
*/
{
}
if (!Table)
{
}
/* Validate the root table checksum */
if (ACPI_FAILURE (Status))
{
}
/* Get the number of entries and pointer to first entry */
for (i = 0; i < TableCount; i++)
{
/* Get the table physical address (32-bit for RSDT, 64-bit for XSDT) */
if (!Address)
{
goto NextTable;
}
if (ACPI_SUCCESS (Status) &&
{
AcpiTbParseFadt ();
}
}
}