ACK: [PATCH 1/2] acpica: update to version 20140325 (LP: #1297531)
IvanHu
ivan.hu at canonical.com
Wed Mar 26 02:14:58 UTC 2014
On 03/26/2014 06:52 AM, Colin King wrote:
> From: Colin Ian King <colin.king at canonical.com>
>
> For the specific ACPICA changes please refer to:
>
> https://lists.acpica.org/pipermail/devel/2014-March/000644.html
>
> This has been checked against my ACPI table database against the
> older version using the method and syntax checks that exercise
> the ACPICA execution and compilation components.
>
> This patchset dismisses 6 issues as found by Coverity Scan.
>
> Signed-off-by: Colin Ian King <colin.king at canonical.com>
> ---
> src/acpica/Makefile.am | 3 +
> src/acpica/source/common/adfile.c | 9 +-
> src/acpica/source/common/adisasm.c | 87 +-
> src/acpica/source/common/adwalk.c | 8 +-
> src/acpica/source/common/ahids.c | 286 +++++++
> src/acpica/source/common/ahpredef.c | 34 +
> src/acpica/source/common/cmfsize.c | 183 +++++
> src/acpica/source/common/dmextern.c | 33 +-
> src/acpica/source/compiler/Makefile.am | 3 +
> src/acpica/source/compiler/aslcompile.c | 2 +-
> src/acpica/source/compiler/aslerror.c | 6 +-
> src/acpica/source/compiler/aslfileio.c | 72 +-
> src/acpica/source/compiler/aslmain.c | 42 +
> src/acpica/source/compiler/aslmessages.h | 2 +-
> src/acpica/source/compiler/aslstubs.c | 2 +-
> src/acpica/source/compiler/aslutils.c | 2 +-
> src/acpica/source/compiler/dtcompiler.h | 4 -
> src/acpica/source/compiler/dtio.c | 14 +-
> src/acpica/source/compiler/dtutils.c | 30 -
> src/acpica/source/compiler/fwts_iasl_interface.c | 4 +
> src/acpica/source/components/debugger/dbcmds.c | 27 +-
> src/acpica/source/components/debugger/dbfileio.c | 37 +-
> src/acpica/source/components/debugger/dbmethod.c | 5 +
> .../source/components/disassembler/dmbuffer.c | 114 +--
> .../source/components/disassembler/dmopcode.c | 195 ++++-
> src/acpica/source/components/disassembler/dmwalk.c | 11 +-
> src/acpica/source/components/dispatcher/dsmethod.c | 19 +-
> src/acpica/source/components/events/evmisc.c | 2 +-
> src/acpica/source/components/events/evsci.c | 2 +-
> src/acpica/source/components/events/evxface.c | 62 +-
> src/acpica/source/components/executer/exconfig.c | 79 +-
> src/acpica/source/components/executer/exdump.c | 3 +-
> src/acpica/source/components/tables/tbdata.c | 888 ++++++++++++++++++++
> src/acpica/source/components/tables/tbfadt.c | 4 +-
> src/acpica/source/components/tables/tbfind.c | 2 +-
> src/acpica/source/components/tables/tbinstal.c | 889 ++++++++-------------
> src/acpica/source/components/tables/tbutils.c | 175 +---
> src/acpica/source/components/tables/tbxface.c | 6 +-
> src/acpica/source/components/tables/tbxfload.c | 92 ++-
> src/acpica/source/components/utilities/utdecode.c | 77 +-
> src/acpica/source/components/utilities/utstring.c | 2 +-
> src/acpica/source/include/acapps.h | 12 +-
> src/acpica/source/include/acbuffer.h | 5 -
> src/acpica/source/include/acconfig.h | 4 -
> src/acpica/source/include/acdebug.h | 4 -
> src/acpica/source/include/acdisasm.h | 16 +-
> src/acpica/source/include/acdispat.h | 4 -
> src/acpica/source/include/acevents.h | 4 -
> src/acpica/source/include/acexcep.h | 4 -
> src/acpica/source/include/acglobal.h | 15 +-
> src/acpica/source/include/achware.h | 4 -
> src/acpica/source/include/acinterp.h | 4 -
> src/acpica/source/include/aclocal.h | 12 +-
> src/acpica/source/include/acmacros.h | 4 -
> src/acpica/source/include/acnamesp.h | 4 -
> src/acpica/source/include/acobject.h | 7 +-
> src/acpica/source/include/acoutput.h | 4 -
> src/acpica/source/include/acparser.h | 4 -
> src/acpica/source/include/acpiosxf.h | 4 -
> src/acpica/source/include/acpixf.h | 13 +-
> src/acpica/source/include/acpredef.h | 4 -
> src/acpica/source/include/acresrc.h | 4 -
> src/acpica/source/include/acrestyp.h | 4 -
> src/acpica/source/include/acstruct.h | 5 -
> src/acpica/source/include/actables.h | 91 ++-
> src/acpica/source/include/actbl.h | 15 +-
> src/acpica/source/include/actbl1.h | 6 +-
> src/acpica/source/include/actbl2.h | 6 +-
> src/acpica/source/include/actbl3.h | 6 +-
> src/acpica/source/include/actypes.h | 4 -
> src/acpica/source/include/acutils.h | 16 +-
> src/acpica/source/include/amlcode.h | 5 -
> src/acpica/source/include/amlresrc.h | 5 -
> src/acpica/source/include/platform/acgcc.h | 11 +
> src/acpica/source/include/platform/aclinux.h | 13 +-
> .../source/os_specific/service_layers/osunixxf.c | 2 +-
> src/acpica/source/tools/acpiexec/aecommon.h | 5 -
> src/acpica/source/tools/acpiexec/aehandlers.c | 6 +-
> 78 files changed, 2575 insertions(+), 1278 deletions(-)
> create mode 100755 src/acpica/source/common/ahids.c
> create mode 100755 src/acpica/source/common/cmfsize.c
> create mode 100755 src/acpica/source/components/tables/tbdata.c
>
> diff --git a/src/acpica/Makefile.am b/src/acpica/Makefile.am
> index 306efb5..0937ce3 100644
> --- a/src/acpica/Makefile.am
> +++ b/src/acpica/Makefile.am
> @@ -197,6 +197,7 @@ libfwtsacpica_la_SOURCES = \
> source/components/resources/rsxface.c \
> source/components/resources/rsserial.c \
> source/components/resources/rsdumpinfo.c \
> + source/components/tables/tbdata.c \
> source/components/tables/tbfadt.c \
> source/components/tables/tbfind.c \
> source/components/tables/tbinstal.c \
> @@ -235,6 +236,8 @@ libfwtsacpica_la_SOURCES = \
> source/components/utilities/uterror.c \
> source/components/utilities/utbuffer.c \
> source/common/acgetline.c \
> + source/common/ahids.c \
> + source/common/cmfsize.c \
> source/tools/acpiexec/aehandlers.c
>
> libfwtsacpica_la_LIBADD = \
> diff --git a/src/acpica/source/common/adfile.c b/src/acpica/source/common/adfile.c
> index 43532b7..3426107 100644
> --- a/src/acpica/source/common/adfile.c
> +++ b/src/acpica/source/common/adfile.c
> @@ -275,11 +275,16 @@ FlGenerateFilename (
>
>
> /*
> - * Copy the original filename to a new buffer. Leave room for the worst case
> - * where we append the suffix, an added dot and the null terminator.
> + * Copy the original filename to a new buffer. Leave room for the worst
> + * case where we append the suffix, an added dot and the null terminator.
> */
> NewFilename = ACPI_ALLOCATE_ZEROED ((ACPI_SIZE)
> strlen (InputFilename) + strlen (Suffix) + 2);
> + if (!NewFilename)
> + {
> + return (NULL);
> + }
> +
> strcpy (NewFilename, InputFilename);
>
> /* Try to find the last dot in the filename */
> diff --git a/src/acpica/source/common/adisasm.c b/src/acpica/source/common/adisasm.c
> index 12805ee..52afb31 100644
> --- a/src/acpica/source/common/adisasm.c
> +++ b/src/acpica/source/common/adisasm.c
> @@ -151,10 +151,6 @@ NsSetupNamespaceListing (
>
> /* Local prototypes */
>
> -static UINT32
> -AdGetFileSize (
> - FILE *File);
> -
> static void
> AdCreateTableHeader (
> char *Filename,
> @@ -229,38 +225,6 @@ static ACPI_PARSE_OBJECT *AcpiGbl_ParseOpRoot;
>
> /*******************************************************************************
> *
> - * FUNCTION: AdGetFileSize
> - *
> - * PARAMETERS: File - Open file handle
> - *
> - * RETURN: File Size
> - *
> - * DESCRIPTION: Get current file size. Uses seek-to-EOF. File must be open.
> - *
> - ******************************************************************************/
> -
> -static UINT32
> -AdGetFileSize (
> - FILE *File)
> -{
> - UINT32 FileSize;
> - long Offset;
> -
> -
> - Offset = ftell (File);
> -
> - fseek (File, 0, SEEK_END);
> - FileSize = (UINT32) ftell (File);
> -
> - /* Restore file pointer */
> -
> - fseek (File, Offset, SEEK_SET);
> - return (FileSize);
> -}
> -
> -
> -/*******************************************************************************
> - *
> * FUNCTION: AdInitialize
> *
> * PARAMETERS: None
> @@ -278,7 +242,7 @@ AdInitialize (
> ACPI_STATUS Status;
>
>
> - /* ACPI CA subsystem initialization */
> + /* ACPICA subsystem initialization */
>
> Status = AcpiOsInitialize ();
> if (ACPI_FAILURE (Status))
> @@ -453,7 +417,7 @@ AdAmlDisassemble (
> /* Create/Open a disassembly output file */
>
> DisasmFilename = FlGenerateFilename (Prefix, FILE_SUFFIX_DISASSEMBLY);
> - if (!OutFilename)
> + if (!DisasmFilename)
> {
> fprintf (stderr, "Could not generate output filename\n");
> Status = AE_ERROR;
> @@ -485,7 +449,7 @@ AdAmlDisassemble (
> fprintf (stderr, "Acpi Data Table [%4.4s] decoded\n",
> Table->Signature);
> fprintf (stderr, "Formatted output: %s - %u bytes\n",
> - DisasmFilename, AdGetFileSize (File));
> + DisasmFilename, CmGetFileSize (File));
> }
> else
> {
> @@ -541,9 +505,10 @@ AdAmlDisassemble (
> "reparsing with new information\n",
> AcpiDmGetExternalMethodCount ());
>
> - /* Reparse, rebuild namespace. no need to xref namespace */
> + /* Reparse, rebuild namespace */
>
> AcpiPsDeleteParseTree (AcpiGbl_ParseOpRoot);
> + AcpiGbl_ParseOpRoot = NULL;
> AcpiNsDeleteNamespaceSubtree (AcpiGbl_RootNode);
>
> AcpiGbl_RootNode = NULL;
> @@ -557,6 +522,9 @@ AdAmlDisassemble (
> AcpiGbl_RootNodeStruct.Flags = 0;
>
> Status = AcpiNsRootInitialize ();
> +
> + /* New namespace, add the external definitions first */
> +
> AcpiDmAddExternalsToNamespace ();
>
> /* Parse the table again. No need to reload it, however */
> @@ -569,6 +537,14 @@ AdAmlDisassemble (
> goto Cleanup;
> }
>
> + /* Cross reference the namespace again */
> +
> + AcpiDmFinishNamespaceLoad (AcpiGbl_ParseOpRoot,
> + AcpiGbl_RootNode, OwnerId);
> +
> + AcpiDmCrossReferenceNamespace (AcpiGbl_ParseOpRoot,
> + AcpiGbl_RootNode, OwnerId);
> +
> if (AslCompilerdebug)
> {
> AcpiOsPrintf ("/**** After second load and resource conversion\n");
> @@ -603,7 +579,7 @@ AdAmlDisassemble (
>
> fprintf (stderr, "Disassembly completed\n");
> fprintf (stderr, "ASL Output: %s - %u bytes\n",
> - DisasmFilename, AdGetFileSize (File));
> + DisasmFilename, CmGetFileSize (File));
> }
> }
>
> @@ -640,7 +616,7 @@ Cleanup:
> *
> * RETURN: None
> *
> - * DESCRIPTION: Create the disassembler header, including ACPI CA signon with
> + * DESCRIPTION: Create the disassembler header, including ACPICA signon with
> * current time and date.
> *
> *****************************************************************************/
> @@ -672,7 +648,7 @@ AdDisassemblerHeader (
> *
> * RETURN: None
> *
> - * DESCRIPTION: Create the ASL table header, including ACPI CA signon with
> + * DESCRIPTION: Create the ASL table header, including ACPICA signon with
> * current time and date.
> *
> *****************************************************************************/
> @@ -750,8 +726,17 @@ AdCreateTableHeader (
> else
> {
> NewFilename = ACPI_ALLOCATE_ZEROED (9);
> - strncat (NewFilename, Table->Signature, 4);
> - strcat (NewFilename, ".aml");
> + if (NewFilename)
> + {
> + strncat (NewFilename, Table->Signature, 4);
> + strcat (NewFilename, ".aml");
> + }
> + }
> +
> + if (!NewFilename)
> + {
> + AcpiOsPrintf (" **** Could not generate AML output filename\n");
> + return;
> }
>
> /* Open the ASL definition block */
> @@ -944,7 +929,8 @@ AdParseTable (
> if (LoadTable)
> {
> Status = AcpiTbStoreTable ((ACPI_PHYSICAL_ADDRESS) Table, Table,
> - Table->Length, ACPI_TABLE_ORIGIN_ALLOCATED, &TableIndex);
> + Table->Length, ACPI_TABLE_ORIGIN_INTERNAL_VIRTUAL,
> + &TableIndex);
> if (ACPI_FAILURE (Status))
> {
> return (Status);
> @@ -979,9 +965,12 @@ AdParseTable (
> return (AE_OK);
> }
>
> - /* Pass 3: Parse control methods and link their parse trees into the main parse tree */
> -
> - fprintf (stderr, "Parsing Deferred Opcodes (Methods/Buffers/Packages/Regions)\n");
> + /*
> + * Pass 3: Parse control methods and link their parse trees
> + * into the main parse tree
> + */
> + fprintf (stderr,
> + "Parsing Deferred Opcodes (Methods/Buffers/Packages/Regions)\n");
> Status = AcpiDmParseDeferredOps (AcpiGbl_ParseOpRoot);
> fprintf (stderr, "\n");
>
> diff --git a/src/acpica/source/common/adwalk.c b/src/acpica/source/common/adwalk.c
> index ccbad0c..808e4e2 100644
> --- a/src/acpica/source/common/adwalk.c
> +++ b/src/acpica/source/common/adwalk.c
> @@ -832,11 +832,13 @@ AcpiDmXrefDescendingOp (
>
> if ((!(OpInfo->Flags & AML_NAMED)) &&
> (!(OpInfo->Flags & AML_CREATE)) &&
> - (Op->Common.AmlOpcode != AML_INT_NAMEPATH_OP))
> + (Op->Common.AmlOpcode != AML_INT_NAMEPATH_OP) &&
> + (Op->Common.AmlOpcode != AML_NOTIFY_OP))
> {
> goto Exit;
> }
>
> +
> /* Get the NamePath from the appropriate place */
>
> if (OpInfo->Flags & AML_NAMED)
> @@ -873,6 +875,10 @@ AcpiDmXrefDescendingOp (
> Path = NextOp->Common.Value.String;
> }
> }
> + else if (Op->Common.AmlOpcode == AML_NOTIFY_OP)
> + {
> + Path = Op->Common.Value.Arg->Asl.Value.String;
> + }
> else
> {
> Path = Op->Common.Value.String;
> diff --git a/src/acpica/source/common/ahids.c b/src/acpica/source/common/ahids.c
> new file mode 100755
> index 0000000..3e12961
> --- /dev/null
> +++ b/src/acpica/source/common/ahids.c
> @@ -0,0 +1,286 @@
> +/******************************************************************************
> + *
> + * Module Name: ahids - Table of ACPI/PNP _HID/_CID values
> + *
> + *****************************************************************************/
> +
> +/******************************************************************************
> + *
> + * 1. Copyright Notice
> + *
> + * Some or all of this work - Copyright (c) 1999 - 2014, Intel Corp.
> + * All rights reserved.
> + *
> + * 2. License
> + *
> + * 2.1. This is your license from Intel Corp. under its intellectual property
> + * rights. You may have additional license terms from the party that provided
> + * you this software, covering your right to use that party's intellectual
> + * property rights.
> + *
> + * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
> + * copy of the source code appearing in this file ("Covered Code") an
> + * irrevocable, perpetual, worldwide license under Intel's copyrights in the
> + * base code distributed originally by Intel ("Original Intel Code") to copy,
> + * make derivatives, distribute, use and display any portion of the Covered
> + * Code in any form, with the right to sublicense such rights; and
> + *
> + * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
> + * license (with the right to sublicense), under only those claims of Intel
> + * patents that are infringed by the Original Intel Code, to make, use, sell,
> + * offer to sell, and import the Covered Code and derivative works thereof
> + * solely to the minimum extent necessary to exercise the above copyright
> + * license, and in no event shall the patent license extend to any additions
> + * to or modifications of the Original Intel Code. No other license or right
> + * is granted directly or by implication, estoppel or otherwise;
> + *
> + * The above copyright and patent license is granted only if the following
> + * conditions are met:
> + *
> + * 3. Conditions
> + *
> + * 3.1. Redistribution of Source with Rights to Further Distribute Source.
> + * Redistribution of source code of any substantial portion of the Covered
> + * Code or modification with rights to further distribute source must include
> + * the above Copyright Notice, the above License, this list of Conditions,
> + * and the following Disclaimer and Export Compliance provision. In addition,
> + * Licensee must cause all Covered Code to which Licensee contributes to
> + * contain a file documenting the changes Licensee made to create that Covered
> + * Code and the date of any change. Licensee must include in that file the
> + * documentation of any changes made by any predecessor Licensee. Licensee
> + * must include a prominent statement that the modification is derived,
> + * directly or indirectly, from Original Intel Code.
> + *
> + * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
> + * Redistribution of source code of any substantial portion of the Covered
> + * Code or modification without rights to further distribute source must
> + * include the following Disclaimer and Export Compliance provision in the
> + * documentation and/or other materials provided with distribution. In
> + * addition, Licensee may not authorize further sublicense of source of any
> + * portion of the Covered Code, and must include terms to the effect that the
> + * license from Licensee to its licensee is limited to the intellectual
> + * property embodied in the software Licensee provides to its licensee, and
> + * not to intellectual property embodied in modifications its licensee may
> + * make.
> + *
> + * 3.3. Redistribution of Executable. Redistribution in executable form of any
> + * substantial portion of the Covered Code or modification must reproduce the
> + * above Copyright Notice, and the following Disclaimer and Export Compliance
> + * provision in the documentation and/or other materials provided with the
> + * distribution.
> + *
> + * 3.4. Intel retains all right, title, and interest in and to the Original
> + * Intel Code.
> + *
> + * 3.5. Neither the name Intel nor any other trademark owned or controlled by
> + * Intel shall be used in advertising or otherwise to promote the sale, use or
> + * other dealings in products derived from or relating to the Covered Code
> + * without prior written authorization from Intel.
> + *
> + * 4. Disclaimer and Export Compliance
> + *
> + * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
> + * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
> + * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
> + * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
> + * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
> + * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
> + * PARTICULAR PURPOSE.
> + *
> + * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
> + * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
> + * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
> + * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
> + * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
> + * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
> + * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
> + * LIMITED REMEDY.
> + *
> + * 4.3. Licensee shall not export, either directly or indirectly, any of this
> + * software or system incorporating such software without first obtaining any
> + * required license or other approval from the U. S. Department of Commerce or
> + * any other agency or department of the United States Government. In the
> + * event Licensee exports any such software from the United States or
> + * re-exports any such software from a foreign destination, Licensee shall
> + * ensure that the distribution and export/re-export of the software is in
> + * compliance with all laws, regulations, orders, or other restrictions of the
> + * U.S. Export Administration Regulations. Licensee agrees that neither it nor
> + * any of its subsidiaries will export/re-export any technical data, process,
> + * software, or service, directly or indirectly, to any country for which the
> + * United States government or any agency thereof requires an export license,
> + * other governmental approval, or letter of assurance, without first obtaining
> + * such license, approval or letter.
> + *
> + *****************************************************************************/
> +
> +#include "acpi.h"
> +#include "accommon.h"
> +
> +#define _COMPONENT ACPI_UTILITIES
> + ACPI_MODULE_NAME ("ahids")
> +
> +
> +/*
> + * ACPI/PNP Device IDs with description strings
> + */
> +const AH_DEVICE_ID AslDeviceIds[] =
> +{
> + {"10EC5640", "Realtek I2S Audio Codec"},
> + {"80860F0A", "Intel Atom UART Controller"},
> + {"80860F14", "Intel Baytrail SDIO/MMC Host Controller"},
> + {"80860F28", "Intel SST Audio DSP"},
> + {"80860F41", "Intel Baytrail I2C Host Controller"},
> + {"ACPI0001", "SMBus 1.0 Host Controller"},
> + {"ACPI0002", "Smart Battery Subsystem"},
> + {"ACPI0003", "Power Source Device"},
> + {"ACPI0004", "Module Device"},
> + {"ACPI0005", "SMBus 2.0 Host Controller"},
> + {"ACPI0006", "GPE Block Device"},
> + {"ACPI0007", "Processor Device"},
> + {"ACPI0008", "Ambient Light Sensor Device"},
> + {"ACPI0009", "I/O xAPIC Device"},
> + {"ACPI000A", "I/O APIC Device"},
> + {"ACPI000B", "I/O SAPIC Device"},
> + {"ACPI000C", "Processor Aggregator Device"},
> + {"ACPI000D", "Power Meter Device"},
> + {"ACPI000E", "Time and Alarm Device"},
> + {"ACPI000F", "User Presence Detection Device"},
> + {"ATK4001", "Asus Radio Control Button"},
> + {"ATML1000", "Atmel Touchscreen Controller"},
> + {"BCM2E39", "Broadcom BT Serial Bus Driver over UART Bus Enumerator"},
> + {"CPLM3218", "Capella Micro CM3218x Ambient Light Sensor"},
> + {"DELLABCE", "Dell Airplane Mode Switch Driver"},
> + {"DLAC3002", "Qualcomm Atheros Bluetooth UART Transport"},
> + {"INT0002", "Virtual GPIO Controller"},
> + {"INT0800", "Intel 82802 Firmware Hub Device"},
> + {"INT3394", "ACPI System Fan"},
> + {"INT3396", "Standard Power Management Controller"},
> + {"INT33A0", "Intel Smart Connect Technology Device"},
> + {"INT33A1", "Intel Power Engine"},
> + {"INT33BB", "Intel Baytrail SD Host Controller"},
> + {"INT33BD", "Intel Baytrail Mailbox Device"},
> + {"INT33C0", "Intel Serial I/O SPI Host Controller"},
> + {"INT33C1", "Intel Serial I/O SPI Host Controller"},
> + {"INT33C2", "Intel Serial I/O I2C Host Controller"},
> + {"INT33C3", "Intel Serial I/O I2C Host Controller"},
> + {"INT33C4", "Intel Serial I/O UART Host Controller"},
> + {"INT33C5", "Intel Serial I/O UART Host Controller"},
> + {"INT33C6", "Intel SD Host Controller"},
> + {"INT33C7", "Intel Serial I/O GPIO Host Controller"},
> + {"INT33C8", "Intel Smart Sound Technology Host Controller"},
> + {"INT33C9", "Wolfson Microelectronics Audio WM5102"},
> + {"INT33CA", "Intel SPB Peripheral"},
> + {"INT33CB", "Intel Smart Sound Technology Audio Codec"},
> + {"INT33D1", "Intel GPIO Buttons"},
> + {"INT33D2", "Intel GPIO Buttons"},
> + {"INT33D3", "Intel GPIO Buttons"},
> + {"INT33D4", "Intel GPIO Buttons"},
> + {"INT33D6", "Intel Virtual Buttons Device"},
> + {"INT33F0", "Camera Sensor MT9M114"},
> + {"INT33FB", "MIPI-CSI Camera Sensor OV2722"},
> + {"INT33FC", "Intel Baytrail GPIO Controller"},
> + {"INT33FD", "Intel Baytrail Power Management IC"},
> + {"INT3400", "Intel Dynamic Power Performance Management"},
> + {"INT3401", "Intel Extended Thermal Model CPU"},
> + {"INT3403", "DPTF Temperature Sensor"},
> + {"INT3406", "Intel Dynamic Platform & Thermal Framework Display Participant"},
> + {"INT3407", "DPTF Platform Power Meter"},
> + {"INT340E", "Motherboard Resources"},
> + {"INT3420", "Intel Bluetooth RF Kill"},
> + {"INT3F0D", "ACPI Motherboard Resources"},
> + {"INTCF1A", "Sony IMX175 Camera Sensor"},
> + {"INTCFD9", "Intel Baytrail SOC GPIO Controller"},
> + {"INTL9C60", "Intel Baytrail SOC DMA Controller"},
> + {"INVN6500", "InvenSense MPU-6500 Six Axis Gyroscope and Accelerometer"},
> + {"LNXCPU", "Linux Logical CPU"},
> + {"LNXPOWER", "ACPI Power Resource (power gating)"},
> + {"LNXPWRBN", "System Power Button"},
> + {"LNXSYBUS", "System Bus"},
> + {"LNXSYSTM", "ACPI Root Node"},
> + {"LNXTHERM", "ACPI Thermal Zone"},
> + {"LNXVIDEO", "ACPI Video Controller"},
> + {"MSFT0101", "TPM 2.0 Security Device"},
> + {"NXP5442", "NXP 5442 Near Field Communications Controller"},
> + {"PNP0000", "8259-compatible Programmable Interrupt Controller"},
> + {"PNP0001", "EISA Interrupt Controller"},
> + {"PNP0002", "MCA Interrupt Controller"},
> + {"PNP0003", "IO-APIC Interrupt Controller"},
> + {"PNP0100", "PC-class System Timer"},
> + {"PNP0103", "HPET System Timer"},
> + {"PNP0200", "PC-class DMA Controller"},
> + {"PNP0300", "IBM PC/XT Keyboard Controller (83 key)"},
> + {"PNP0301", "IBM PC/XT Keyboard Controller (86 key)"},
> + {"PNP0302", "IBM PC/XT Keyboard Controller (84 key)"},
> + {"PNP0303", "IBM Enhanced Keyboard (101/102-key, PS/2 Mouse)"},
> + {"PNP0400", "Standard LPT Parallel Port"},
> + {"PNP0401", "ECP Parallel Port"},
> + {"PNP0500", "Standard PC COM Serial Port"},
> + {"PNP0501", "16550A-compatible COM Serial Port"},
> + {"PNP0510", "Generic IRDA-compatible Device"},
> + {"PNP0800", "Microsoft Sound System Compatible Device"},
> + {"PNP0A03", "PCI Bus"},
> + {"PNP0A05", "Generic Container Device"},
> + {"PNP0A06", "Generic Container Device"},
> + {"PNP0A08", "PCI Express Bus"},
> + {"PNP0B00", "AT Real-Time Clock"},
> + {"PNP0B01", "Intel PIIX4-compatible RTC/CMOS Device"},
> + {"PNP0B02", "Dallas Semiconductor-compatible RTC/CMOS Device"},
> + {"PNP0C01", "System Board"},
> + {"PNP0C02", "PNP Motherboard Resources"},
> + {"PNP0C04", "x87-compatible Floating Point Processing Unit"},
> + {"PNP0C08", "ACPI Core Hardware"},
> + {"PNP0C09", "Embedded Controller Device"},
> + {"PNP0C0A", "Control Method Battery"},
> + {"PNP0C0B", "Fan (Thermal Solution)"},
> + {"PNP0C0C", "Power Button Device"},
> + {"PNP0C0D", "Lid Device"},
> + {"PNP0C0E", "Sleep Button Device"},
> + {"PNP0C0F", "PCI Interrupt Link Device"},
> + {"PNP0C10", "System Indicator Device"},
> + {"PNP0C11", "Thermal Zone"},
> + {"PNP0C12", "Device Bay Controller"},
> + {"PNP0C14", "Windows Management Instrumentation Device"},
> + {"PNP0C15", "Docking Station"},
> + {"PNP0C40", "Standard Button Controller"},
> + {"PNP0C50", "HID Protocol Device (I2C bus)"},
> + {"PNP0C60", "Display Sensor Device"},
> + {"PNP0C70", "Dock Sensor Device"},
> + {"PNP0C80", "Memory Device"},
> + {"PNP0D40", "Standard Compliant SD Host Controller"},
> + {"PNP0D80", "Windows-compatible System Power Management Controller"},
> + {"PNP0F03", "Microsoft PS/2-style Mouse"},
> + {"SMO91D0", "Sensor Hub"},
> +
> + {NULL, NULL}
> +};
> +
> +
> +/*******************************************************************************
> + *
> + * FUNCTION: AcpiAhMatchHardwareId
> + *
> + * PARAMETERS: HardwareId - String representation of an _HID or _CID
> + *
> + * RETURN: ID info struct. NULL if HardwareId is not found
> + *
> + * DESCRIPTION: Lookup an _HID/_CID in the device ID table
> + *
> + ******************************************************************************/
> +
> +const AH_DEVICE_ID *
> +AcpiAhMatchHardwareId (
> + char *HardwareId)
> +{
> + const AH_DEVICE_ID *Info;
> +
> +
> + for (Info = AslDeviceIds; Info->Name; Info++)
> + {
> + if (!ACPI_STRCMP (HardwareId, Info->Name))
> + {
> + return (Info);
> + }
> + }
> +
> + return (NULL);
> +}
> diff --git a/src/acpica/source/common/ahpredef.c b/src/acpica/source/common/ahpredef.c
> index 3c46b16..1bb6a8a 100644
> --- a/src/acpica/source/common/ahpredef.c
> +++ b/src/acpica/source/common/ahpredef.c
> @@ -116,6 +116,9 @@
> #include "acpi.h"
> #include "accommon.h"
>
> +#define _COMPONENT ACPI_UTILITIES
> + ACPI_MODULE_NAME ("ahpredef")
> +
> /*
> * iASL only needs a partial table (short descriptions only).
> * AcpiHelp needs the full table.
> @@ -393,3 +396,34 @@ const AH_PREDEFINED_NAME AslPredefinedInfo[] =
> AH_PREDEF ("_Wxx", "Wake Event", "Method executed as a result of a wake event"),
> AH_PREDEF (NULL, NULL, NULL)
> };
> +
> +
> +/*******************************************************************************
> + *
> + * FUNCTION: AcpiAhMatchPredefinedName
> + *
> + * PARAMETERS: Nameseg - Predefined name string
> + *
> + * RETURN: ID info struct. NULL if Nameseg not found
> + *
> + * DESCRIPTION: Lookup a predefined name.
> + *
> + ******************************************************************************/
> +
> +const AH_PREDEFINED_NAME *
> +AcpiAhMatchPredefinedName (
> + char *Nameseg)
> +{
> + const AH_PREDEFINED_NAME *Info;
> +
> +
> + for (Info = AslPredefinedInfo; Info->Name; Info++)
> + {
> + if (ACPI_COMPARE_NAME (Nameseg, Info->Name))
> + {
> + return (Info);
> + }
> + }
> +
> + return (NULL);
> +}
> diff --git a/src/acpica/source/common/cmfsize.c b/src/acpica/source/common/cmfsize.c
> new file mode 100755
> index 0000000..1bb3fba
> --- /dev/null
> +++ b/src/acpica/source/common/cmfsize.c
> @@ -0,0 +1,183 @@
> +/******************************************************************************
> + *
> + * Module Name: cfsize - Common get file size function
> + *
> + *****************************************************************************/
> +
> +/******************************************************************************
> + *
> + * 1. Copyright Notice
> + *
> + * Some or all of this work - Copyright (c) 1999 - 2014, Intel Corp.
> + * All rights reserved.
> + *
> + * 2. License
> + *
> + * 2.1. This is your license from Intel Corp. under its intellectual property
> + * rights. You may have additional license terms from the party that provided
> + * you this software, covering your right to use that party's intellectual
> + * property rights.
> + *
> + * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
> + * copy of the source code appearing in this file ("Covered Code") an
> + * irrevocable, perpetual, worldwide license under Intel's copyrights in the
> + * base code distributed originally by Intel ("Original Intel Code") to copy,
> + * make derivatives, distribute, use and display any portion of the Covered
> + * Code in any form, with the right to sublicense such rights; and
> + *
> + * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
> + * license (with the right to sublicense), under only those claims of Intel
> + * patents that are infringed by the Original Intel Code, to make, use, sell,
> + * offer to sell, and import the Covered Code and derivative works thereof
> + * solely to the minimum extent necessary to exercise the above copyright
> + * license, and in no event shall the patent license extend to any additions
> + * to or modifications of the Original Intel Code. No other license or right
> + * is granted directly or by implication, estoppel or otherwise;
> + *
> + * The above copyright and patent license is granted only if the following
> + * conditions are met:
> + *
> + * 3. Conditions
> + *
> + * 3.1. Redistribution of Source with Rights to Further Distribute Source.
> + * Redistribution of source code of any substantial portion of the Covered
> + * Code or modification with rights to further distribute source must include
> + * the above Copyright Notice, the above License, this list of Conditions,
> + * and the following Disclaimer and Export Compliance provision. In addition,
> + * Licensee must cause all Covered Code to which Licensee contributes to
> + * contain a file documenting the changes Licensee made to create that Covered
> + * Code and the date of any change. Licensee must include in that file the
> + * documentation of any changes made by any predecessor Licensee. Licensee
> + * must include a prominent statement that the modification is derived,
> + * directly or indirectly, from Original Intel Code.
> + *
> + * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
> + * Redistribution of source code of any substantial portion of the Covered
> + * Code or modification without rights to further distribute source must
> + * include the following Disclaimer and Export Compliance provision in the
> + * documentation and/or other materials provided with distribution. In
> + * addition, Licensee may not authorize further sublicense of source of any
> + * portion of the Covered Code, and must include terms to the effect that the
> + * license from Licensee to its licensee is limited to the intellectual
> + * property embodied in the software Licensee provides to its licensee, and
> + * not to intellectual property embodied in modifications its licensee may
> + * make.
> + *
> + * 3.3. Redistribution of Executable. Redistribution in executable form of any
> + * substantial portion of the Covered Code or modification must reproduce the
> + * above Copyright Notice, and the following Disclaimer and Export Compliance
> + * provision in the documentation and/or other materials provided with the
> + * distribution.
> + *
> + * 3.4. Intel retains all right, title, and interest in and to the Original
> + * Intel Code.
> + *
> + * 3.5. Neither the name Intel nor any other trademark owned or controlled by
> + * Intel shall be used in advertising or otherwise to promote the sale, use or
> + * other dealings in products derived from or relating to the Covered Code
> + * without prior written authorization from Intel.
> + *
> + * 4. Disclaimer and Export Compliance
> + *
> + * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
> + * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
> + * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
> + * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
> + * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
> + * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
> + * PARTICULAR PURPOSE.
> + *
> + * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
> + * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
> + * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
> + * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
> + * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
> + * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
> + * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
> + * LIMITED REMEDY.
> + *
> + * 4.3. Licensee shall not export, either directly or indirectly, any of this
> + * software or system incorporating such software without first obtaining any
> + * required license or other approval from the U. S. Department of Commerce or
> + * any other agency or department of the United States Government. In the
> + * event Licensee exports any such software from the United States or
> + * re-exports any such software from a foreign destination, Licensee shall
> + * ensure that the distribution and export/re-export of the software is in
> + * compliance with all laws, regulations, orders, or other restrictions of the
> + * U.S. Export Administration Regulations. Licensee agrees that neither it nor
> + * any of its subsidiaries will export/re-export any technical data, process,
> + * software, or service, directly or indirectly, to any country for which the
> + * United States government or any agency thereof requires an export license,
> + * other governmental approval, or letter of assurance, without first obtaining
> + * such license, approval or letter.
> + *
> + *****************************************************************************/
> +
> +#include "acpi.h"
> +#include "accommon.h"
> +#include "acapps.h"
> +#include <stdio.h>
> +
> +#define _COMPONENT ACPI_TOOLS
> + ACPI_MODULE_NAME ("cmfsize")
> +
> +
> +/*******************************************************************************
> + *
> + * FUNCTION: CmGetFileSize
> + *
> + * PARAMETERS: File - Open file descriptor
> + *
> + * RETURN: File Size. On error, -1 (ACPI_UINT32_MAX)
> + *
> + * DESCRIPTION: Get the size of a file. Uses seek-to-EOF. File must be open.
> + * Does not disturb the current file pointer. Uses perror for
> + * error messages.
> + *
> + ******************************************************************************/
> +
> +UINT32
> +CmGetFileSize (
> + FILE *File)
> +{
> + long FileSize;
> + long CurrentOffset;
> +
> +
> + /* Save the current file pointer, seek to EOF to obtain file size */
> +
> + CurrentOffset = ftell (File);
> + if (CurrentOffset < 0)
> + {
> + goto OffsetError;
> + }
> +
> + if (fseek (File, 0, SEEK_END))
> + {
> + goto SeekError;
> + }
> +
> + FileSize = ftell (File);
> + if (FileSize < 0)
> + {
> + goto OffsetError;
> + }
> +
> + /* Restore original file pointer */
> +
> + if (fseek (File, CurrentOffset, SEEK_SET))
> + {
> + goto SeekError;
> + }
> +
> + return ((UINT32) FileSize);
> +
> +
> +OffsetError:
> + perror ("Could not get file offset");
> + return (ACPI_UINT32_MAX);
> +
> +SeekError:
> + perror ("Could not seek file");
> + return (ACPI_UINT32_MAX);
> +}
> diff --git a/src/acpica/source/common/dmextern.c b/src/acpica/source/common/dmextern.c
> index e54dee7..efd72f6 100644
> --- a/src/acpica/source/common/dmextern.c
> +++ b/src/acpica/source/common/dmextern.c
> @@ -139,7 +139,7 @@
> */
> static const char *AcpiGbl_DmTypeNames[] =
> {
> - /* 00 */ "", /* Type ANY */
> + /* 00 */ ", UnknownObj", /* Type ANY */
> /* 01 */ ", IntObj",
> /* 02 */ ", StrObj",
> /* 03 */ ", BuffObj",
> @@ -469,6 +469,7 @@ AcpiDmGetExternalsFromFile (
> {
> fprintf (stderr, "Could not open external reference file \"%s\"\n",
> Gbl_ExternalRefFilename);
> + AslAbort ();
> return;
> }
>
> @@ -863,7 +864,8 @@ AcpiDmCreateNewExternal (
> /* Duplicate method, check that the Value (ArgCount) is the same */
>
> if ((NextExternal->Type == ACPI_TYPE_METHOD) &&
> - (NextExternal->Value != Value))
> + (NextExternal->Value != Value) &&
> + (Value > 0))
> {
> ACPI_ERROR ((AE_INFO,
> "External method arg count mismatch %s: Current %u, attempted %u",
> @@ -1137,9 +1139,8 @@ AcpiDmEmitExternals (
> NextExternal->Path,
> AcpiDmGetObjectTypeName (NextExternal->Type));
>
> - AcpiOsPrintf (
> - ") // Warning: Unresolved Method, "
> - "guessing %u arguments (may be incorrect, see warning above)\n",
> + AcpiOsPrintf (") // Warning: Unresolved method, "
> + "guessing %u arguments\n",
> NextExternal->Value);
>
> NextExternal->Flags |= ACPI_EXT_EXTERNAL_EMITTED;
> @@ -1347,8 +1348,14 @@ AcpiDmUnresolvedWarning (
> " * control method external declarations with the associated method\n"
> " * argument counts. Each line of the file must be of the form:\n"
> " * External (<method pathname>, MethodObj, <argument count>)\n"
> + " * Invocation:\n"
> + " * iasl -fe refs.txt -d dsdt.aml\n"
> + " *\n"
> + " * The following methods were unresolved and many not compile properly\n"
> + " * because the disassembler had to guess at the number of arguments\n"
> + " * required for each:\n"
> " */\n",
> - AcpiGbl_NumExternalMethods);
> + AcpiGbl_NumExternalMethods);
> }
> else if (AcpiGbl_NumExternalMethods != AcpiGbl_ResolvedExternalMethods)
> {
> @@ -1366,6 +1373,12 @@ AcpiDmUnresolvedWarning (
> " * control method external declarations with the associated method\n"
> " * argument counts. Each line of the file must be of the form:\n"
> " * External (<method pathname>, MethodObj, <argument count>)\n"
> + " * Invocation:\n"
> + " * iasl -fe refs.txt -d dsdt.aml\n"
> + " *\n"
> + " * The following methods were unresolved and many not compile properly\n"
> + " * because the disassembler had to guess at the number of arguments\n"
> + " * required for each:\n"
> " */\n",
> AcpiGbl_NumExternalMethods, AcpiGbl_ResolvedExternalMethods,
> (AcpiGbl_ResolvedExternalMethods > 1 ? "were" : "was"),
> @@ -1393,7 +1406,9 @@ AcpiDmUnresolvedWarning (
> "In addition, the -fe option can be used to specify a file containing\n"
> "control method external declarations with the associated method\n"
> "argument counts. Each line of the file must be of the form:\n"
> - " External (<method pathname>, MethodObj, <argument count>)\n",
> + " External (<method pathname>, MethodObj, <argument count>)\n"
> + "Invocation:\n"
> + " iasl -fe refs.txt -d dsdt.aml\n",
> AcpiGbl_NumExternalMethods);
> }
> else if (AcpiGbl_NumExternalMethods != AcpiGbl_ResolvedExternalMethods)
> @@ -1411,7 +1426,9 @@ AcpiDmUnresolvedWarning (
> "If necessary, the -fe option can be used to specify a file containing\n"
> "control method external declarations with the associated method\n"
> "argument counts. Each line of the file must be of the form:\n"
> - " External (<method pathname>, MethodObj, <argument count>)\n",
> + " External (<method pathname>, MethodObj, <argument count>)\n"
> + "Invocation:\n"
> + " iasl -fe refs.txt -d dsdt.aml\n",
> AcpiGbl_NumExternalMethods, AcpiGbl_ResolvedExternalMethods,
> (AcpiGbl_ResolvedExternalMethods > 1 ? "were" : "was"),
> (AcpiGbl_NumExternalMethods - AcpiGbl_ResolvedExternalMethods));
> diff --git a/src/acpica/source/compiler/Makefile.am b/src/acpica/source/compiler/Makefile.am
> index b690888..1c215b2 100644
> --- a/src/acpica/source/compiler/Makefile.am
> +++ b/src/acpica/source/compiler/Makefile.am
> @@ -193,7 +193,9 @@ libfwtsiasl_la_SOURCES = \
> ../common/adfile.c \
> ../common/adisasm.c \
> ../common/adwalk.c \
> + ../common/ahids.c \
> ../common/ahpredef.c \
> + ../common/cmfsize.c \
> ../common/dmextern.c \
> ../common/dmrestag.c \
> ../common/dmtable.c \
> @@ -211,6 +213,7 @@ libfwtsiasl_la_SOURCES = \
> ../components/disassembler/dmwalk.c \
> ../components/disassembler/dmdeferred.c \
> ../components/disassembler/dmresrcl2.c \
> + ../components/tables/tbdata.c \
> ../components/tables/tbfadt.c \
> ../components/tables/tbinstal.c \
> ../components/tables/tbutils.c \
> diff --git a/src/acpica/source/compiler/aslcompile.c b/src/acpica/source/compiler/aslcompile.c
> index 4ed8afe..8f14ef5 100644
> --- a/src/acpica/source/compiler/aslcompile.c
> +++ b/src/acpica/source/compiler/aslcompile.c
> @@ -462,7 +462,7 @@ FlCheckForAcpiTable (
>
> /* Header length field must match the file size */
>
> - FileSize = DtGetFileSize (Handle);
> + FileSize = CmGetFileSize (Handle);
> if (Table.Length != FileSize)
> {
> return (AE_ERROR);
> diff --git a/src/acpica/source/compiler/aslerror.c b/src/acpica/source/compiler/aslerror.c
> index 21ca7d5..e096894 100644
> --- a/src/acpica/source/compiler/aslerror.c
> +++ b/src/acpica/source/compiler/aslerror.c
> @@ -946,14 +946,14 @@ AslError (
> * FUNCTION: AslCoreSubsystemError
> *
> * PARAMETERS: Op - Parse node where error happened
> - * Status - The ACPI CA Exception
> + * Status - The ACPICA Exception
> * ExtraMessage - additional error message
> * Abort - TRUE -> Abort compilation
> *
> * RETURN: None
> *
> - * DESCRIPTION: Error reporting routine for exceptions returned by the ACPI
> - * CA core subsystem.
> + * DESCRIPTION: Error reporting routine for exceptions returned by the ACPICA
> + * core subsystem.
> *
> ******************************************************************************/
>
> diff --git a/src/acpica/source/compiler/aslfileio.c b/src/acpica/source/compiler/aslfileio.c
> index 50f1534..ee84a12 100644
> --- a/src/acpica/source/compiler/aslfileio.c
> +++ b/src/acpica/source/compiler/aslfileio.c
> @@ -114,14 +114,11 @@
> *****************************************************************************/
>
> #include "aslcompiler.h"
> +#include "acapps.h"
>
> #define _COMPONENT ACPI_COMPILER
> ACPI_MODULE_NAME ("aslfileio")
>
> -long
> -UtGetFileSize (
> - FILE *fp);
> -
>
> /*******************************************************************************
> *
> @@ -187,65 +184,6 @@ FlOpenFile (
>
> /*******************************************************************************
> *
> - * FUNCTION: UtGetFileSize
> - *
> - * PARAMETERS: fp - Open file handle
> - *
> - * RETURN: File Size. -1 on error.
> - *
> - * DESCRIPTION: Get current file size. Uses seek-to-EOF. File must be open.
> - * TBD: This function should be used to replace other similar
> - * functions in ACPICA.
> - *
> - ******************************************************************************/
> -
> -long
> -UtGetFileSize (
> - FILE *fp)
> -{
> - long FileSize;
> - long CurrentOffset;
> -
> -
> - CurrentOffset = ftell (fp);
> - if (CurrentOffset < 0)
> - {
> - goto OffsetError;
> - }
> -
> - if (fseek (fp, 0, SEEK_END))
> - {
> - goto SeekError;
> - }
> -
> - FileSize = ftell (fp);
> - if (FileSize < 0)
> - {
> - goto OffsetError;
> - }
> -
> - /* Restore file pointer */
> -
> - if (fseek (fp, CurrentOffset, SEEK_SET))
> - {
> - goto SeekError;
> - }
> -
> - return (FileSize);
> -
> -
> -OffsetError:
> - perror ("Could not get file offset");
> - return (-1);
> -
> -SeekError:
> - perror ("Could not seek file");
> - return (-1);
> -}
> -
> -
> -/*******************************************************************************
> - *
> * FUNCTION: FlGetFileSize
> *
> * PARAMETERS: FileId - Index into file info array
> @@ -261,16 +199,16 @@ UINT32
> FlGetFileSize (
> UINT32 FileId)
> {
> - long FileSize;
> + UINT32 FileSize;
>
>
> - FileSize = UtGetFileSize (Gbl_Files[FileId].Handle);
> - if (FileSize == -1)
> + FileSize = CmGetFileSize (Gbl_Files[FileId].Handle);
> + if (FileSize == ACPI_UINT32_MAX)
> {
> AslAbort();
> }
>
> - return ((UINT32) FileSize);
> + return (FileSize);
> }
>
>
> diff --git a/src/acpica/source/compiler/aslmain.c b/src/acpica/source/compiler/aslmain.c
> index 72a6c06..1dfbc0a 100644
> --- a/src/acpica/source/compiler/aslmain.c
> +++ b/src/acpica/source/compiler/aslmain.c
> @@ -145,6 +145,36 @@ static void
> AslInitialize (
> void);
>
> +UINT8
> +AcpiIsBigEndianMachine (
> + void);
> +
> +
> +/*******************************************************************************
> + *
> + * FUNCTION: AcpiIsBigEndianMachine
> + *
> + * PARAMETERS: None
> + *
> + * RETURN: TRUE if machine is big endian
> + * FALSE if machine is little endian
> + *
> + * DESCRIPTION: Detect whether machine is little endian or big endian.
> + *
> + ******************************************************************************/
> +
> +UINT8
> +AcpiIsBigEndianMachine (
> + void)
> +{
> + union {
> + UINT32 Integer;
> + UINT8 Bytes[4];
> + } Overlay = {0xFF000000};
> +
> + return (Overlay.Bytes[0]); /* Returns 0xFF (TRUE) for big endian */
> +}
> +
>
> /*******************************************************************************
> *
> @@ -371,6 +401,18 @@ main (
> int Index2;
>
>
> + /*
> + * Big-endian machines are not currently supported. ACPI tables must
> + * be little-endian, and support for big-endian machines needs to
> + * be implemented.
> + */
> + if (AcpiIsBigEndianMachine ())
> + {
> + fprintf (stderr,
> + "iASL is not currently supported on big-endian machines.\n");
> + return (-1);
> + }
> +
> ACPI_DEBUG_INITIALIZE (); /* For debug version only */
>
> /* Initialize preprocessor and compiler before command line processing */
> diff --git a/src/acpica/source/compiler/aslmessages.h b/src/acpica/source/compiler/aslmessages.h
> index 0e29ec2..c544eac 100644
> --- a/src/acpica/source/compiler/aslmessages.h
> +++ b/src/acpica/source/compiler/aslmessages.h
> @@ -368,7 +368,7 @@ char *AslMessages [] =
> /* ASL_MSG_CONNECTION_INVALID */ "Invalid OpRegion SpaceId for use of Connection operator",
> /* ASL_MSG_CONSTANT_EVALUATION */ "Could not evaluate constant expression",
> /* ASL_MSG_CONSTANT_FOLDED */ "Constant expression evaluated and reduced",
> -/* ASL_MSG_CORE_EXCEPTION */ "From ACPI CA Subsystem",
> +/* ASL_MSG_CORE_EXCEPTION */ "From ACPICA Subsystem",
> /* ASL_MSG_DEBUG_FILE_OPEN */ "Could not open debug file",
> /* ASL_MSG_DEBUG_FILENAME */ "Could not create debug filename",
> /* ASL_MSG_DEPENDENT_NESTING */ "Dependent function macros cannot be nested",\
> diff --git a/src/acpica/source/compiler/aslstubs.c b/src/acpica/source/compiler/aslstubs.c
> index 5c5ced4..9e43a0d 100644
> --- a/src/acpica/source/compiler/aslstubs.c
> +++ b/src/acpica/source/compiler/aslstubs.c
> @@ -125,7 +125,7 @@
>
>
> /*
> - * Stubs to simplify linkage to the ACPI CA core subsystem.
> + * Stubs to simplify linkage to the ACPICA core subsystem.
> * Things like Events, Global Lock, etc. are not used
> * by the compiler, so they are stubbed out here.
> */
> diff --git a/src/acpica/source/compiler/aslutils.c b/src/acpica/source/compiler/aslutils.c
> index 5fdca1b..f33c3bd 100644
> --- a/src/acpica/source/compiler/aslutils.c
> +++ b/src/acpica/source/compiler/aslutils.c
> @@ -990,7 +990,7 @@ UtDoConstant (
> }
>
>
> -/* TBD: use version in ACPI CA main code base? */
> +/* TBD: use version in ACPICA main code base? */
>
> /*******************************************************************************
> *
> diff --git a/src/acpica/source/compiler/dtcompiler.h b/src/acpica/source/compiler/dtcompiler.h
> index 9694770..cc1b73f 100644
> --- a/src/acpica/source/compiler/dtcompiler.h
> +++ b/src/acpica/source/compiler/dtcompiler.h
> @@ -415,10 +415,6 @@ DtStrtoul64 (
> char *String,
> UINT64 *ReturnInteger);
>
> -UINT32
> -DtGetFileSize (
> - FILE *Handle);
> -
> char*
> DtGetFieldValue (
> DT_FIELD *Field);
> diff --git a/src/acpica/source/compiler/dtio.c b/src/acpica/source/compiler/dtio.c
> index 16cafef..1465cc0 100644
> --- a/src/acpica/source/compiler/dtio.c
> +++ b/src/acpica/source/compiler/dtio.c
> @@ -117,6 +117,7 @@
>
> #include "aslcompiler.h"
> #include "dtcompiler.h"
> +#include "acapps.h"
>
> #define _COMPONENT DT_COMPILER
> ACPI_MODULE_NAME ("dtio")
> @@ -809,7 +810,11 @@ DtScanFile (
>
> /* Get the file size */
>
> - Gbl_InputByteCount = DtGetFileSize (Handle);
> + Gbl_InputByteCount = CmGetFileSize (Handle);
> + if (Gbl_InputByteCount == ACPI_UINT32_MAX)
> + {
> + AslAbort ();
> + }
>
> Gbl_CurrentLineNumber = 0;
> Gbl_CurrentLineOffset = 0;
> @@ -888,7 +893,12 @@ DtOutputBinary (
> /* Walk the entire parse tree, emitting the binary data */
>
> DtWalkTableTree (RootTable, DtWriteBinary, NULL, NULL);
> - Gbl_TableLength = DtGetFileSize (Gbl_Files[ASL_FILE_AML_OUTPUT].Handle);
> +
> + Gbl_TableLength = CmGetFileSize (Gbl_Files[ASL_FILE_AML_OUTPUT].Handle);
> + if (Gbl_TableLength == ACPI_UINT32_MAX)
> + {
> + AslAbort ();
> + }
> }
>
>
> diff --git a/src/acpica/source/compiler/dtutils.c b/src/acpica/source/compiler/dtutils.c
> index 6fdffd2..62ca4a3 100644
> --- a/src/acpica/source/compiler/dtutils.c
> +++ b/src/acpica/source/compiler/dtutils.c
> @@ -358,36 +358,6 @@ DtStrtoul64 (
>
> /******************************************************************************
> *
> - * FUNCTION: DtGetFileSize
> - *
> - * PARAMETERS: Handle - Open file handler
> - *
> - * RETURN: Current file size
> - *
> - * DESCRIPTION: Get the current size of a file. Seek to the EOF and get the
> - * offset. Seek back to the original location.
> - *
> - *****************************************************************************/
> -
> -UINT32
> -DtGetFileSize (
> - FILE *Handle)
> -{
> - int CurrentOffset;
> - int LastOffset;
> -
> -
> - CurrentOffset = ftell (Handle);
> - fseek (Handle, 0, SEEK_END);
> - LastOffset = ftell (Handle);
> - fseek (Handle, CurrentOffset, SEEK_SET);
> -
> - return ((UINT32) LastOffset);
> -}
> -
> -
> -/******************************************************************************
> - *
> * FUNCTION: DtGetFieldValue
> *
> * PARAMETERS: Field - Current field list pointer
> diff --git a/src/acpica/source/compiler/fwts_iasl_interface.c b/src/acpica/source/compiler/fwts_iasl_interface.c
> index 607dec3..180dadd 100644
> --- a/src/acpica/source/compiler/fwts_iasl_interface.c
> +++ b/src/acpica/source/compiler/fwts_iasl_interface.c
> @@ -37,7 +37,9 @@ static void init_asl_core(void)
> {
> int i;
>
> + AcpiGbl_ExternalFileList = NULL;
> AcpiDbgLevel = 0;
> + PrInitializePreprocessor ();
>
> for (i = 0; i < ASL_NUM_FILES; i++) {
> Gbl_Files[i].Handle = NULL;
> @@ -79,6 +81,7 @@ int fwts_iasl_disassemble_aml(const char *aml, const char *outputfile)
> Gbl_DoCompile = FALSE;
> Gbl_OutputFilenamePrefix = (char*)outputfile;
> Gbl_UseDefaultAmlFilename = FALSE;
> + UtConvertBackslashes (Gbl_OutputFilenamePrefix);
>
> /* Throw away noisy errors */
> if (freopen("/dev/null", "w", stderr) != NULL)
> @@ -165,6 +168,7 @@ int fwts_iasl_assemble_aml(const char *source, char **stdout_output, char **stde
> Gbl_PreprocessFlag = TRUE;
> Gbl_UseDefaultAmlFilename = FALSE;
> Gbl_OutputFilenamePrefix = (char*)source;
> + UtConvertBackslashes (Gbl_OutputFilenamePrefix);
>
> (void)AslDoOneFile((char *)source);
>
> diff --git a/src/acpica/source/components/debugger/dbcmds.c b/src/acpica/source/components/debugger/dbcmds.c
> index b0d1cc1..d74f61c 100644
> --- a/src/acpica/source/components/debugger/dbcmds.c
> +++ b/src/acpica/source/components/debugger/dbcmds.c
> @@ -188,7 +188,7 @@ AcpiDbConvertToNode (
> Node = ACPI_TO_POINTER (Address);
> if (!AcpiOsReadable (Node, sizeof (ACPI_NAMESPACE_NODE)))
> {
> - AcpiOsPrintf ("Address %p is invalid in this address space\n",
> + AcpiOsPrintf ("Address %p is invalid",
> Node);
> return (NULL);
> }
> @@ -197,7 +197,7 @@ AcpiDbConvertToNode (
>
> if (ACPI_GET_DESCRIPTOR_TYPE (Node) != ACPI_DESC_TYPE_NAMED)
> {
> - AcpiOsPrintf ("Address %p is not a valid NS node [%s]\n",
> + AcpiOsPrintf ("Address %p is not a valid namespace node [%s]\n",
> Node, AcpiUtGetDescriptorName (Node));
> return (NULL);
> }
> @@ -211,6 +211,8 @@ AcpiDbConvertToNode (
> Node = AcpiDbLocalNsLookup (InString);
> if (!Node)
> {
> + AcpiOsPrintf ("Could not find [%s] in namespace, defaulting to root node\n",
> + InString);
> Node = AcpiGbl_RootNode;
> }
> }
> @@ -434,24 +436,19 @@ AcpiDbDisplayTableInfo (
>
> switch (TableDesc->Flags & ACPI_TABLE_ORIGIN_MASK)
> {
> - case ACPI_TABLE_ORIGIN_UNKNOWN:
> + case ACPI_TABLE_ORIGIN_EXTERNAL_VIRTUAL:
>
> - AcpiOsPrintf ("Unknown ");
> + AcpiOsPrintf ("External virtual ");
> break;
>
> - case ACPI_TABLE_ORIGIN_MAPPED:
> + case ACPI_TABLE_ORIGIN_INTERNAL_PHYSICAL:
>
> - AcpiOsPrintf ("Mapped ");
> + AcpiOsPrintf ("Internal physical ");
> break;
>
> - case ACPI_TABLE_ORIGIN_ALLOCATED:
> + case ACPI_TABLE_ORIGIN_INTERNAL_VIRTUAL:
>
> - AcpiOsPrintf ("Allocated ");
> - break;
> -
> - case ACPI_TABLE_ORIGIN_OVERRIDE:
> -
> - AcpiOsPrintf ("Override ");
> + AcpiOsPrintf ("Internal virtual ");
> break;
>
> default:
> @@ -462,7 +459,7 @@ AcpiDbDisplayTableInfo (
>
> /* Make sure that the table is mapped */
>
> - Status = AcpiTbVerifyTable (TableDesc);
> + Status = AcpiTbValidateTable (TableDesc);
> if (ACPI_FAILURE (Status))
> {
> return;
> @@ -512,8 +509,6 @@ AcpiDbUnloadAcpiTable (
> Node = AcpiDbConvertToNode (ObjectName);
> if (!Node)
> {
> - AcpiOsPrintf ("Could not find [%s] in namespace\n",
> - ObjectName);
> return;
> }
>
> diff --git a/src/acpica/source/components/debugger/dbfileio.c b/src/acpica/source/components/debugger/dbfileio.c
> index 16f6e12..3d456e5 100644
> --- a/src/acpica/source/components/debugger/dbfileio.c
> +++ b/src/acpica/source/components/debugger/dbfileio.c
> @@ -214,6 +214,8 @@ AcpiDbOpenDebugFile (
>
>
> #ifdef ACPI_APPLICATION
> +#include "acapps.h"
> +
> /*******************************************************************************
> *
> * FUNCTION: AcpiDbCheckTextModeCorruption
> @@ -318,9 +320,11 @@ AcpiDbReadTable (
>
> /* Get the file size */
>
> - fseek (fp, 0, SEEK_END);
> - FileSize = (UINT32) ftell (fp);
> - fseek (fp, 0, SEEK_SET);
> + FileSize = CmGetFileSize (fp);
> + if (FileSize == ACPI_UINT32_MAX)
> + {
> + return (AE_ERROR);
> + }
>
> if (FileSize < 4)
> {
> @@ -493,7 +497,7 @@ AeLocalLoadTable (
>
> /* Install the new table into the local data structures */
>
> - Status = AcpiTbInstallTable (&TableInfo);
> + Status = AcpiTbInitTableDescriptor (&TableInfo);
> if (ACPI_FAILURE (Status))
> {
> if (Status == AE_ALREADY_EXISTS)
> @@ -547,23 +551,23 @@ AcpiDbReadTableFromFile (
> FILE *File;
> UINT32 FileSize;
> UINT32 TableLength;
> - ACPI_STATUS Status;
> + ACPI_STATUS Status = AE_ERROR;
>
>
> - /* Open the file */
> + /* Open the file, get current size */
>
> File = fopen (Filename, "rb");
> if (!File)
> {
> perror ("Could not open input file");
> - return (AE_ERROR);
> + return (Status);
> }
>
> - /* Get the file size */
> -
> - fseek (File, 0, SEEK_END);
> - FileSize = (UINT32) ftell (File);
> - fseek (File, 0, SEEK_SET);
> + FileSize = CmGetFileSize (File);
> + if (FileSize == ACPI_UINT32_MAX)
> + {
> + goto Exit;
> + }
>
> /* Get the entire file */
>
> @@ -571,15 +575,14 @@ AcpiDbReadTableFromFile (
> Filename, FileSize, FileSize);
>
> Status = AcpiDbReadTable (File, Table, &TableLength);
> - fclose(File);
> -
> if (ACPI_FAILURE (Status))
> {
> AcpiOsPrintf ("Could not get table from the file\n");
> - return (Status);
> }
>
> - return (AE_OK);
> +Exit:
> + fclose(File);
> + return (Status);
> }
> #endif
>
> @@ -639,6 +642,8 @@ AcpiDbGetTableFromFile (
> return (Status);
> }
>
> + AcpiTbPrintTableHeader (0, Table);
> +
> fprintf (stderr,
> "Acpi table [%4.4s] successfully installed and loaded\n",
> Table->Signature);
> diff --git a/src/acpica/source/components/debugger/dbmethod.c b/src/acpica/source/components/debugger/dbmethod.c
> index f21cff9..39a9fa7 100644
> --- a/src/acpica/source/components/debugger/dbmethod.c
> +++ b/src/acpica/source/components/debugger/dbmethod.c
> @@ -252,6 +252,11 @@ AcpiDbSetMethodData (
> if (Type == 'N')
> {
> Node = AcpiDbConvertToNode (IndexArg);
> + if (!Node)
> + {
> + return;
> + }
> +
> if (Node->Type != ACPI_TYPE_INTEGER)
> {
> AcpiOsPrintf ("Can only set Integer nodes\n");
> diff --git a/src/acpica/source/components/disassembler/dmbuffer.c b/src/acpica/source/components/disassembler/dmbuffer.c
> index 108e989..cfdf33b 100644
> --- a/src/acpica/source/components/disassembler/dmbuffer.c
> +++ b/src/acpica/source/components/disassembler/dmbuffer.c
> @@ -119,6 +119,7 @@
> #include "acdisasm.h"
> #include "acparser.h"
> #include "amlcode.h"
> +#include "acinterp.h"
>
>
> #ifdef ACPI_DISASSEMBLER
> @@ -133,7 +134,7 @@ AcpiDmUnicode (
> ACPI_PARSE_OBJECT *Op);
>
> static void
> -AcpiDmIsEisaIdElement (
> +AcpiDmGetHardwareIdType (
> ACPI_PARSE_OBJECT *Op);
>
> static void
> @@ -609,19 +610,20 @@ AcpiDmUnicode (
>
> /*******************************************************************************
> *
> - * FUNCTION: AcpiDmIsEisaIdElement
> + * FUNCTION: AcpiDmGetHardwareIdType
> *
> * PARAMETERS: Op - Op to be examined
> *
> * RETURN: None
> *
> - * DESCRIPTION: Determine if an Op (argument to _HID or _CID) can be converted
> - * to an EISA ID.
> + * DESCRIPTION: Determine the type of the argument to a _HID or _CID
> + * 1) Strings are allowed
> + * 2) If Integer, determine if it is a valid EISAID
> *
> ******************************************************************************/
>
> static void
> -AcpiDmIsEisaIdElement (
> +AcpiDmGetHardwareIdType (
> ACPI_PARSE_OBJECT *Op)
> {
> UINT32 BigEndianId;
> @@ -629,55 +631,66 @@ AcpiDmIsEisaIdElement (
> UINT32 i;
>
>
> - /* The parameter must be either a word or a dword */
> -
> - if ((Op->Common.AmlOpcode != AML_DWORD_OP) &&
> - (Op->Common.AmlOpcode != AML_WORD_OP))
> + switch (Op->Common.AmlOpcode)
> {
> - return;
> - }
> + case AML_STRING_OP:
>
> - /* Swap from little-endian to big-endian to simplify conversion */
> + /* Mark this string as an _HID/_CID string */
>
> - BigEndianId = AcpiUtDwordByteSwap ((UINT32) Op->Common.Value.Integer);
> + Op->Common.DisasmOpcode = ACPI_DASM_HID_STRING;
> + break;
>
> - /* Create the 3 leading ASCII letters */
> + case AML_WORD_OP:
> + case AML_DWORD_OP:
>
> - Prefix[0] = ((BigEndianId >> 26) & 0x1F) + 0x40;
> - Prefix[1] = ((BigEndianId >> 21) & 0x1F) + 0x40;
> - Prefix[2] = ((BigEndianId >> 16) & 0x1F) + 0x40;
> + /* Determine if a Word/Dword is a valid encoded EISAID */
>
> - /* Verify that all 3 are ascii and alpha */
> + /* Swap from little-endian to big-endian to simplify conversion */
>
> - for (i = 0; i < 3; i++)
> - {
> - if (!ACPI_IS_ASCII (Prefix[i]) ||
> - !ACPI_IS_ALPHA (Prefix[i]))
> + BigEndianId = AcpiUtDwordByteSwap ((UINT32) Op->Common.Value.Integer);
> +
> + /* Create the 3 leading ASCII letters */
> +
> + Prefix[0] = ((BigEndianId >> 26) & 0x1F) + 0x40;
> + Prefix[1] = ((BigEndianId >> 21) & 0x1F) + 0x40;
> + Prefix[2] = ((BigEndianId >> 16) & 0x1F) + 0x40;
> +
> + /* Verify that all 3 are ascii and alpha */
> +
> + for (i = 0; i < 3; i++)
> {
> - return;
> + if (!ACPI_IS_ASCII (Prefix[i]) ||
> + !ACPI_IS_ALPHA (Prefix[i]))
> + {
> + return;
> + }
> }
> - }
>
> - /* OK - mark this node as convertable to an EISA ID */
> + /* Mark this node as convertable to an EISA ID string */
>
> - Op->Common.DisasmOpcode = ACPI_DASM_EISAID;
> + Op->Common.DisasmOpcode = ACPI_DASM_EISAID;
> + break;
> +
> + default:
> + break;
> + }
> }
>
>
> /*******************************************************************************
> *
> - * FUNCTION: AcpiDmIsEisaId
> + * FUNCTION: AcpiDmCheckForHardwareId
> *
> * PARAMETERS: Op - Op to be examined
> *
> * RETURN: None
> *
> - * DESCRIPTION: Determine if a Name() Op can be converted to an EisaId.
> + * DESCRIPTION: Determine if a Name() Op is a _HID/_CID.
> *
> ******************************************************************************/
>
> void
> -AcpiDmIsEisaId (
> +AcpiDmCheckForHardwareId (
> ACPI_PARSE_OBJECT *Op)
> {
> UINT32 Name;
> @@ -702,7 +715,7 @@ AcpiDmIsEisaId (
>
> if (ACPI_COMPARE_NAME (&Name, METHOD_NAME__HID))
> {
> - AcpiDmIsEisaIdElement (NextOp);
> + AcpiDmGetHardwareIdType (NextOp);
> return;
> }
>
> @@ -717,11 +730,11 @@ AcpiDmIsEisaId (
>
> if (NextOp->Common.AmlOpcode != AML_PACKAGE_OP)
> {
> - AcpiDmIsEisaIdElement (NextOp);
> + AcpiDmGetHardwareIdType (NextOp);
> return;
> }
>
> - /* _CID with Package: get the package length */
> + /* _CID with Package: get the package length, check all elements */
>
> NextOp = AcpiPsGetDepthNext (NULL, NextOp);
>
> @@ -730,7 +743,7 @@ AcpiDmIsEisaId (
> NextOp = NextOp->Common.Next;
> while (NextOp)
> {
> - AcpiDmIsEisaIdElement (NextOp);
> + AcpiDmGetHardwareIdType (NextOp);
> NextOp = NextOp->Common.Next;
> }
> }
> @@ -738,41 +751,38 @@ AcpiDmIsEisaId (
>
> /*******************************************************************************
> *
> - * FUNCTION: AcpiDmEisaId
> + * FUNCTION: AcpiDmDecompressEisaId
> *
> * PARAMETERS: EncodedId - Raw encoded EISA ID.
> *
> * RETURN: None
> *
> - * DESCRIPTION: Convert an encoded EISAID back to the original ASCII String.
> + * DESCRIPTION: Convert an encoded EISAID back to the original ASCII String
> + * and emit the correct ASL statement. If the ID is known, emit
> + * a description of the ID as a comment.
> *
> ******************************************************************************/
>
> void
> -AcpiDmEisaId (
> +AcpiDmDecompressEisaId (
> UINT32 EncodedId)
> {
> - UINT32 BigEndianId;
> -
> + char IdBuffer[ACPI_EISAID_STRING_SIZE];
> + const AH_DEVICE_ID *Info;
>
> - /* Swap from little-endian to big-endian to simplify conversion */
>
> - BigEndianId = AcpiUtDwordByteSwap (EncodedId);
> + /* Convert EISAID to a string an emit the statement */
>
> + AcpiExEisaIdToString (IdBuffer, EncodedId);
> + AcpiOsPrintf ("EisaId (\"%s\")", IdBuffer);
>
> - /* Split to form "AAANNNN" string */
> + /* If we know about the ID, emit the description */
>
> - AcpiOsPrintf ("EisaId (\"%c%c%c%4.4X\")",
> -
> - /* Three Alpha characters (AAA), 5 bits each */
> -
> - (int) ((BigEndianId >> 26) & 0x1F) + 0x40,
> - (int) ((BigEndianId >> 21) & 0x1F) + 0x40,
> - (int) ((BigEndianId >> 16) & 0x1F) + 0x40,
> -
> - /* Numeric part (NNNN) is simply the lower 16 bits */
> -
> - (UINT32) (BigEndianId & 0xFFFF));
> + Info = AcpiAhMatchHardwareId (IdBuffer);
> + if (Info)
> + {
> + AcpiOsPrintf (" /* %s */", Info->Description);
> + }
> }
>
> #endif
> diff --git a/src/acpica/source/components/disassembler/dmopcode.c b/src/acpica/source/components/disassembler/dmopcode.c
> index 0564244..db30c00 100644
> --- a/src/acpica/source/components/disassembler/dmopcode.c
> +++ b/src/acpica/source/components/disassembler/dmopcode.c
> @@ -118,6 +118,8 @@
> #include "acparser.h"
> #include "amlcode.h"
> #include "acdisasm.h"
> +#include "acinterp.h"
> +#include "acnamesp.h"
>
> #ifdef ACPI_DISASSEMBLER
>
> @@ -133,6 +135,159 @@ AcpiDmMatchKeyword (
>
> /*******************************************************************************
> *
> + * FUNCTION: AcpiDmDisplayTargetPathname
> + *
> + * PARAMETERS: Op - Parse object
> + *
> + * RETURN: None
> + *
> + * DESCRIPTION: For AML opcodes that have a target operand, display the full
> + * pathname for the target, in a comment field. Handles Return()
> + * statements also.
> + *
> + ******************************************************************************/
> +
> +void
> +AcpiDmDisplayTargetPathname (
> + ACPI_PARSE_OBJECT *Op)
> +{
> + ACPI_PARSE_OBJECT *NextOp;
> + ACPI_PARSE_OBJECT *PrevOp = NULL;
> + char *Pathname;
> + const ACPI_OPCODE_INFO *OpInfo;
> +
> +
> + if (Op->Common.AmlOpcode == AML_RETURN_OP)
> + {
> + PrevOp = Op->Asl.Value.Arg;
> + }
> + else
> + {
> + OpInfo = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode);
> + if (!(OpInfo->Flags & AML_HAS_TARGET))
> + {
> + return;
> + }
> +
> + /* Target is the last Op in the arg list */
> +
> + NextOp = Op->Asl.Value.Arg;
> + while (NextOp)
> + {
> + PrevOp = NextOp;
> + NextOp = PrevOp->Asl.Next;
> + }
> + }
> +
> + if (!PrevOp)
> + {
> + return;
> + }
> +
> + /* We must have a namepath AML opcode */
> +
> + if (PrevOp->Asl.AmlOpcode != AML_INT_NAMEPATH_OP)
> + {
> + return;
> + }
> +
> + /* A null string is the "no target specified" case */
> +
> + if (!PrevOp->Asl.Value.String)
> + {
> + return;
> + }
> +
> + /* No node means "unresolved external reference" */
> +
> + if (!PrevOp->Asl.Node)
> + {
> + AcpiOsPrintf (" /* External reference */");
> + return;
> + }
> +
> + /* Ignore if path is already from the root */
> +
> + if (*PrevOp->Asl.Value.String == '\\')
> + {
> + return;
> + }
> +
> + /* Now: we can get the full pathname */
> +
> + Pathname = AcpiNsGetExternalPathname (PrevOp->Asl.Node);
> + if (!Pathname)
> + {
> + return;
> + }
> +
> + AcpiOsPrintf (" /* %s */", Pathname);
> + ACPI_FREE (Pathname);
> +}
> +
> +
> +/*******************************************************************************
> + *
> + * FUNCTION: AcpiDmNotifyDescription
> + *
> + * PARAMETERS: Op - Name() parse object
> + *
> + * RETURN: None
> + *
> + * DESCRIPTION: Emit a description comment for the value associated with a
> + * Notify() operator.
> + *
> + ******************************************************************************/
> +
> +void
> +AcpiDmNotifyDescription (
> + ACPI_PARSE_OBJECT *Op)
> +{
> + ACPI_PARSE_OBJECT *NextOp;
> + ACPI_NAMESPACE_NODE *Node;
> + UINT8 NotifyValue;
> + UINT8 Type = ACPI_TYPE_ANY;
> +
> +
> + /* The notify value is the second argument */
> +
> + NextOp = Op->Asl.Value.Arg;
> + NextOp = NextOp->Asl.Next;
> +
> + switch (NextOp->Common.AmlOpcode)
> + {
> + case AML_ZERO_OP:
> + case AML_ONE_OP:
> +
> + NotifyValue = (UINT8) NextOp->Common.AmlOpcode;
> + break;
> +
> + case AML_BYTE_OP:
> +
> + NotifyValue = (UINT8) NextOp->Asl.Value.Integer;
> + break;
> +
> + default:
> + return;
> + }
> +
> + /*
> + * Attempt to get the namespace node so we can determine the object type.
> + * Some notify values are dependent on the object type (Device, Thermal,
> + * or Processor).
> + */
> + Node = Op->Asl.Node;
> + if (Node)
> + {
> + Type = Node->Type;
> + }
> +
> + AcpiOsPrintf (" // %s", AcpiUtGetNotifyName (NotifyValue, Type));
> +}
> +
> +
> +/*******************************************************************************
> + *
> * FUNCTION: AcpiDmPredefinedDescription
> *
> * PARAMETERS: Op - Name() parse object
> @@ -255,14 +410,11 @@ AcpiDmPredefinedDescription (
>
> /* Match the name in the info table */
>
> - for (Info = AslPredefinedInfo; Info->Name; Info++)
> + Info = AcpiAhMatchPredefinedName (NameString);
> + if (Info)
> {
> - if (ACPI_COMPARE_NAME (NameString, Info->Name))
> - {
> - AcpiOsPrintf (" // %4.4s: %s",
> - NameString, ACPI_CAST_PTR (char, Info->Description));
> - return;
> - }
> + AcpiOsPrintf (" // %4.4s: %s",
> + NameString, ACPI_CAST_PTR (char, Info->Description));
> }
>
> #endif
> @@ -339,14 +491,11 @@ AcpiDmFieldPredefinedDescription (
>
> /* Match the name in the info table */
>
> - for (Info = AslPredefinedInfo; Info->Name; Info++)
> + Info = AcpiAhMatchPredefinedName (Tag);
> + if (Info)
> {
> - if (ACPI_COMPARE_NAME (Tag, Info->Name))
> - {
> - AcpiOsPrintf (" // %4.4s: %s", Tag,
> - ACPI_CAST_PTR (char, Info->Description));
> - return;
> - }
> + AcpiOsPrintf (" // %4.4s: %s", Tag,
> + ACPI_CAST_PTR (char, Info->Description));
> }
>
> #endif
> @@ -599,6 +748,7 @@ AcpiDmDisassembleOneOp (
> ACPI_PARSE_OBJECT *Child;
> ACPI_STATUS Status;
> UINT8 *Aml;
> + const AH_DEVICE_ID *IdInfo;
>
>
> if (!Op)
> @@ -677,7 +827,7 @@ AcpiDmDisassembleOneOp (
>
> if (Op->Common.DisasmOpcode == ACPI_DASM_EISAID)
> {
> - AcpiDmEisaId ((UINT32) Op->Common.Value.Integer);
> + AcpiDmDecompressEisaId ((UINT32) Op->Common.Value.Integer);
> }
> else
> {
> @@ -689,7 +839,7 @@ AcpiDmDisassembleOneOp (
>
> if (Op->Common.DisasmOpcode == ACPI_DASM_EISAID)
> {
> - AcpiDmEisaId ((UINT32) Op->Common.Value.Integer);
> + AcpiDmDecompressEisaId ((UINT32) Op->Common.Value.Integer);
> }
> else
> {
> @@ -706,6 +856,19 @@ AcpiDmDisassembleOneOp (
> case AML_STRING_OP:
>
> AcpiUtPrintString (Op->Common.Value.String, ACPI_UINT16_MAX);
> +
> + /* For _HID/_CID strings, attempt to output a descriptive comment */
> +
> + if (Op->Common.DisasmOpcode == ACPI_DASM_HID_STRING)
> + {
> + /* If we know about the ID, emit the description */
> +
> + IdInfo = AcpiAhMatchHardwareId (Op->Common.Value.String);
> + if (IdInfo)
> + {
> + AcpiOsPrintf (" /* %s */", IdInfo->Description);
> + }
> + }
> break;
>
> case AML_BUFFER_OP:
> diff --git a/src/acpica/source/components/disassembler/dmwalk.c b/src/acpica/source/components/disassembler/dmwalk.c
> index 9d9a0cc..ff72620 100644
> --- a/src/acpica/source/components/disassembler/dmwalk.c
> +++ b/src/acpica/source/components/disassembler/dmwalk.c
> @@ -640,7 +640,7 @@ AcpiDmDescendingOp (
>
> /* Check for _HID and related EISAID() */
>
> - AcpiDmIsEisaId (Op);
> + AcpiDmCheckForHardwareId (Op);
> AcpiOsPrintf (", ");
> break;
>
> @@ -914,6 +914,15 @@ AcpiDmAscendingOp (
> AcpiDmFieldPredefinedDescription (Op);
> }
>
> + /* Decode Notify() values */
> +
> + if (Op->Common.AmlOpcode == AML_NOTIFY_OP)
> + {
> + AcpiDmNotifyDescription (Op);
> + }
> +
> + AcpiDmDisplayTargetPathname (Op);
> +
> /* Could be a nested operator, check if comma required */
>
> if (!AcpiDmCommaIfListMember (Op))
> diff --git a/src/acpica/source/components/dispatcher/dsmethod.c b/src/acpica/source/components/dispatcher/dsmethod.c
> index b2dc658..5d1985a 100644
> --- a/src/acpica/source/components/dispatcher/dsmethod.c
> +++ b/src/acpica/source/components/dispatcher/dsmethod.c
> @@ -258,8 +258,15 @@ AcpiDsDetectNamedOpcodes (
> * At this point, we know we have a Named object opcode.
> * Mark the method as serialized. Later code will create a mutex for
> * this method to enforce serialization.
> + *
> + * Note, ACPI_METHOD_IGNORE_SYNC_LEVEL flag means that we will ignore the
> + * Sync Level mechanism for this method, even though it is now serialized.
> + * Otherwise, there can be conflicts with existing ASL code that actually
> + * uses sync levels.
> */
> - WalkState->MethodDesc->Method.InfoFlags |= ACPI_METHOD_SERIALIZED;
> + WalkState->MethodDesc->Method.SyncLevel = 0;
> + WalkState->MethodDesc->Method.InfoFlags |=
> + (ACPI_METHOD_SERIALIZED | ACPI_METHOD_IGNORE_SYNC_LEVEL);
>
> ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
> "Method serialized [%4.4s] %p - [%s] (%4.4X)\n",
> @@ -449,11 +456,16 @@ AcpiDsBeginMethodExecution (
> /*
> * The CurrentSyncLevel (per-thread) must be less than or equal to
> * the sync level of the method. This mechanism provides some
> - * deadlock prevention
> + * deadlock prevention.
> + *
> + * If the method was auto-serialized, we just ignore the sync level
> + * mechanism, because auto-serialization of methods can interfere
> + * with ASL code that actually uses sync levels.
> *
> * Top-level method invocation has no walk state at this point
> */
> if (WalkState &&
> + (!(ObjDesc->Method.InfoFlags & ACPI_METHOD_IGNORE_SYNC_LEVEL)) &&
> (WalkState->Thread->CurrentSyncLevel > ObjDesc->Method.Mutex->Mutex.SyncLevel))
> {
> ACPI_ERROR ((AE_INFO,
> @@ -921,7 +933,8 @@ AcpiDsTerminateControlMethod (
> * thread exits here.
> */
> MethodDesc->Method.InfoFlags &= ~ACPI_METHOD_SERIALIZED_PENDING;
> - MethodDesc->Method.InfoFlags |= ACPI_METHOD_SERIALIZED;
> + MethodDesc->Method.InfoFlags |=
> + (ACPI_METHOD_SERIALIZED | ACPI_METHOD_IGNORE_SYNC_LEVEL);
> MethodDesc->Method.SyncLevel = 0;
> }
>
> diff --git a/src/acpica/source/components/events/evmisc.c b/src/acpica/source/components/events/evmisc.c
> index f9a5fb1..8b2c3ff 100644
> --- a/src/acpica/source/components/events/evmisc.c
> +++ b/src/acpica/source/components/events/evmisc.c
> @@ -253,7 +253,7 @@ AcpiEvQueueNotifyRequest (
> ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
> "Dispatching Notify on [%4.4s] (%s) Value 0x%2.2X (%s) Node %p\n",
> AcpiUtGetNodeName (Node), AcpiUtGetTypeName (Node->Type),
> - NotifyValue, AcpiUtGetNotifyName (NotifyValue), Node));
> + NotifyValue, AcpiUtGetNotifyName (NotifyValue, ACPI_TYPE_ANY), Node));
>
> Status = AcpiOsExecute (OSL_NOTIFY_HANDLER, AcpiEvNotifyDispatch,
> Info);
> diff --git a/src/acpica/source/components/events/evsci.c b/src/acpica/source/components/events/evsci.c
> index b0c19e5..ec6c1c1 100644
> --- a/src/acpica/source/components/events/evsci.c
> +++ b/src/acpica/source/components/events/evsci.c
> @@ -208,7 +208,7 @@ AcpiEvSciXruptHandler (
>
>
> /*
> - * We are guaranteed by the ACPI CA initialization/shutdown code that
> + * We are guaranteed by the ACPICA initialization/shutdown code that
> * if this interrupt handler is installed, ACPI is enabled.
> */
>
> diff --git a/src/acpica/source/components/events/evxface.c b/src/acpica/source/components/events/evxface.c
> index bba1bfb..85355a5 100644
> --- a/src/acpica/source/components/events/evxface.c
> +++ b/src/acpica/source/components/events/evxface.c
> @@ -338,7 +338,7 @@ AcpiRemoveNotifyHandler (
> ACPI_OPERAND_OBJECT *ObjDesc;
> ACPI_OPERAND_OBJECT *HandlerObj;
> ACPI_OPERAND_OBJECT *PreviousHandlerObj;
> - ACPI_STATUS Status;
> + ACPI_STATUS Status = AE_OK;
> UINT32 i;
>
>
> @@ -353,16 +353,6 @@ AcpiRemoveNotifyHandler (
> return_ACPI_STATUS (AE_BAD_PARAMETER);
> }
>
> - /* Make sure all deferred notify tasks are completed */
> -
> - AcpiOsWaitEventsComplete ();
> -
> - Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE);
> - if (ACPI_FAILURE (Status))
> - {
> - return_ACPI_STATUS (Status);
> - }
> -
> /* Root Object. Global handlers are removed here */
>
> if (Device == ACPI_ROOT_OBJECT)
> @@ -371,6 +361,12 @@ AcpiRemoveNotifyHandler (
> {
> if (HandlerType & (i+1))
> {
> + Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE);
> + if (ACPI_FAILURE (Status))
> + {
> + return_ACPI_STATUS (Status);
> + }
> +
> if (!AcpiGbl_GlobalNotify[i].Handler ||
> (AcpiGbl_GlobalNotify[i].Handler != Handler))
> {
> @@ -383,18 +379,23 @@ AcpiRemoveNotifyHandler (
>
> AcpiGbl_GlobalNotify[i].Handler = NULL;
> AcpiGbl_GlobalNotify[i].Context = NULL;
> +
> + (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
> +
> + /* Make sure all deferred notify tasks are completed */
> +
> + AcpiOsWaitEventsComplete ();
> }
> }
>
> - goto UnlockAndExit;
> + return_ACPI_STATUS (AE_OK);
> }
>
> /* All other objects: Are Notifies allowed on this object? */
>
> if (!AcpiEvIsNotifyObject (Node))
> {
> - Status = AE_TYPE;
> - goto UnlockAndExit;
> + return_ACPI_STATUS (AE_TYPE);
> }
>
> /* Must have an existing internal object */
> @@ -402,8 +403,7 @@ AcpiRemoveNotifyHandler (
> ObjDesc = AcpiNsGetAttachedObject (Node);
> if (!ObjDesc)
> {
> - Status = AE_NOT_EXIST;
> - goto UnlockAndExit;
> + return_ACPI_STATUS (AE_NOT_EXIST);
> }
>
> /* Internal object exists. Find the handler and remove it */
> @@ -412,6 +412,12 @@ AcpiRemoveNotifyHandler (
> {
> if (HandlerType & (i+1))
> {
> + Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE);
> + if (ACPI_FAILURE (Status))
> + {
> + return_ACPI_STATUS (Status);
> + }
> +
> HandlerObj = ObjDesc->CommonNotify.NotifyList[i];
> PreviousHandlerObj = NULL;
>
> @@ -443,10 +449,17 @@ AcpiRemoveNotifyHandler (
> HandlerObj->Notify.Next[i];
> }
>
> + (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
> +
> + /* Make sure all deferred notify tasks are completed */
> +
> + AcpiOsWaitEventsComplete ();
> AcpiUtRemoveReference (HandlerObj);
> }
> }
>
> + return_ACPI_STATUS (Status);
> +
>
> UnlockAndExit:
> (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
> @@ -592,6 +605,8 @@ Exit:
> return_ACPI_STATUS (Status);
> }
>
> +ACPI_EXPORT_SYMBOL (AcpiInstallSciHandler)
> +
>
> /*******************************************************************************
> *
> @@ -668,6 +683,8 @@ UnlockAndExit:
> return_ACPI_STATUS (Status);
> }
>
> +ACPI_EXPORT_SYMBOL (AcpiRemoveSciHandler)
> +
>
> /*******************************************************************************
> *
> @@ -1042,10 +1059,6 @@ AcpiRemoveGpeHandler (
> return_ACPI_STATUS (AE_BAD_PARAMETER);
> }
>
> - /* Make sure all deferred GPE tasks are completed */
> -
> - AcpiOsWaitEventsComplete ();
> -
> Status = AcpiUtAcquireMutex (ACPI_MTX_EVENTS);
> if (ACPI_FAILURE (Status))
> {
> @@ -1102,10 +1115,17 @@ AcpiRemoveGpeHandler (
> (void) AcpiEvAddGpeReference (GpeEventInfo);
> }
>
> + AcpiOsReleaseLock (AcpiGbl_GpeLock, Flags);
> + (void) AcpiUtReleaseMutex (ACPI_MTX_EVENTS);
> +
> + /* Make sure all deferred GPE tasks are completed */
> +
> + AcpiOsWaitEventsComplete ();
> +
> /* Now we can free the handler object */
>
> ACPI_FREE (Handler);
> -
> + return_ACPI_STATUS (Status);
>
> UnlockAndExit:
> AcpiOsReleaseLock (AcpiGbl_GpeLock, Flags);
> diff --git a/src/acpica/source/components/executer/exconfig.c b/src/acpica/source/components/executer/exconfig.c
> index 1c32a33..98caa14 100644
> --- a/src/acpica/source/components/executer/exconfig.c
> +++ b/src/acpica/source/components/executer/exconfig.c
> @@ -453,8 +453,8 @@ AcpiExLoadOp (
> ACPI_WALK_STATE *WalkState)
> {
> ACPI_OPERAND_OBJECT *DdbHandle;
> + ACPI_TABLE_HEADER *TableHeader;
> ACPI_TABLE_HEADER *Table;
> - ACPI_TABLE_DESC TableDesc;
> UINT32 TableIndex;
> ACPI_STATUS Status;
> UINT32 Length;
> @@ -463,8 +463,6 @@ AcpiExLoadOp (
> ACPI_FUNCTION_TRACE (ExLoadOp);
>
>
> - ACPI_MEMSET (&TableDesc, 0, sizeof (ACPI_TABLE_DESC));
> -
> /* Source Object can be either an OpRegion or a Buffer/Field */
>
> switch (ObjDesc->Common.Type)
> @@ -496,16 +494,16 @@ AcpiExLoadOp (
>
> /* Get the table header first so we can get the table length */
>
> - Table = ACPI_ALLOCATE (sizeof (ACPI_TABLE_HEADER));
> - if (!Table)
> + TableHeader = ACPI_ALLOCATE (sizeof (ACPI_TABLE_HEADER));
> + if (!TableHeader)
> {
> return_ACPI_STATUS (AE_NO_MEMORY);
> }
>
> Status = AcpiExRegionRead (ObjDesc, sizeof (ACPI_TABLE_HEADER),
> - ACPI_CAST_PTR (UINT8, Table));
> - Length = Table->Length;
> - ACPI_FREE (Table);
> + ACPI_CAST_PTR (UINT8, TableHeader));
> + Length = TableHeader->Length;
> + ACPI_FREE (TableHeader);
>
> if (ACPI_FAILURE (Status))
> {
> @@ -537,8 +535,8 @@ AcpiExLoadOp (
>
> /* Allocate a buffer for the table */
>
> - TableDesc.Pointer = ACPI_ALLOCATE (Length);
> - if (!TableDesc.Pointer)
> + Table = ACPI_ALLOCATE (Length);
> + if (!Table)
> {
> return_ACPI_STATUS (AE_NO_MEMORY);
> }
> @@ -546,14 +544,12 @@ AcpiExLoadOp (
> /* Read the entire table */
>
> Status = AcpiExRegionRead (ObjDesc, Length,
> - ACPI_CAST_PTR (UINT8, TableDesc.Pointer));
> + ACPI_CAST_PTR (UINT8, Table));
> if (ACPI_FAILURE (Status))
> {
> - ACPI_FREE (TableDesc.Pointer);
> + ACPI_FREE (Table);
> return_ACPI_STATUS (Status);
> }
> -
> - TableDesc.Address = ObjDesc->Region.Address;
> break;
>
> case ACPI_TYPE_BUFFER: /* Buffer or resolved RegionField */
> @@ -570,8 +566,8 @@ AcpiExLoadOp (
>
> /* Get the actual table length from the table header */
>
> - Table = ACPI_CAST_PTR (ACPI_TABLE_HEADER, ObjDesc->Buffer.Pointer);
> - Length = Table->Length;
> + TableHeader = ACPI_CAST_PTR (ACPI_TABLE_HEADER, ObjDesc->Buffer.Pointer);
> + Length = TableHeader->Length;
>
> /* Table cannot extend beyond the buffer */
>
> @@ -588,14 +584,13 @@ AcpiExLoadOp (
> * Copy the table from the buffer because the buffer could be modified
> * or even deleted in the future
> */
> - TableDesc.Pointer = ACPI_ALLOCATE (Length);
> - if (!TableDesc.Pointer)
> + Table = ACPI_ALLOCATE (Length);
> + if (!Table)
> {
> return_ACPI_STATUS (AE_NO_MEMORY);
> }
>
> - ACPI_MEMCPY (TableDesc.Pointer, Table, Length);
> - TableDesc.Address = ACPI_TO_INTEGER (TableDesc.Pointer);
> + ACPI_MEMCPY (Table, TableHeader, Length);
> break;
>
> default:
> @@ -603,28 +598,31 @@ AcpiExLoadOp (
> return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
> }
>
> - /* Validate table checksum (will not get validated in TbAddTable) */
> + /* Install the new table into the local data structures */
> +
> + ACPI_INFO ((AE_INFO, "Dynamic OEM Table Load:"));
> + (void) AcpiUtAcquireMutex (ACPI_MTX_TABLES);
> +
> + Status = AcpiTbInstallStandardTable (ACPI_PTR_TO_PHYSADDR (Table),
> + ACPI_TABLE_ORIGIN_INTERNAL_VIRTUAL, TRUE, TRUE,
> + &TableIndex);
>
> - Status = AcpiTbVerifyChecksum (TableDesc.Pointer, Length);
> + (void) AcpiUtReleaseMutex (ACPI_MTX_TABLES);
> if (ACPI_FAILURE (Status))
> {
> - ACPI_FREE (TableDesc.Pointer);
> + /* Delete allocated table buffer */
> +
> + ACPI_FREE (Table);
> return_ACPI_STATUS (Status);
> }
>
> - /* Complete the table descriptor */
> -
> - TableDesc.Length = Length;
> - TableDesc.Flags = ACPI_TABLE_ORIGIN_ALLOCATED;
> -
> - /* Install the new table into the local data structures */
> -
> - Status = AcpiTbAddTable (&TableDesc, &TableIndex);
> + /*
> + * Note: Now table is "INSTALLED", it must be validated before
> + * loading.
> + */
> + Status = AcpiTbValidateTable (&AcpiGbl_RootTableList.Tables[TableIndex]);
> if (ACPI_FAILURE (Status))
> {
> - /* Delete allocated table buffer */
> -
> - AcpiTbDeleteTable (&TableDesc);
> return_ACPI_STATUS (Status);
> }
>
> @@ -656,9 +654,6 @@ AcpiExLoadOp (
> return_ACPI_STATUS (Status);
> }
>
> - ACPI_INFO ((AE_INFO, "Dynamic OEM Table Load:"));
> - AcpiTbPrintTableHeader (0, TableDesc.Pointer);
> -
> /* Remove the reference by added by AcpiExStore above */
>
> AcpiUtRemoveReference (DdbHandle);
> @@ -667,7 +662,7 @@ AcpiExLoadOp (
>
> if (AcpiGbl_TableHandler)
> {
> - (void) AcpiGbl_TableHandler (ACPI_TABLE_EVENT_LOAD, TableDesc.Pointer,
> + (void) AcpiGbl_TableHandler (ACPI_TABLE_EVENT_LOAD, Table,
> AcpiGbl_TableHandlerContext);
> }
>
> @@ -701,6 +696,14 @@ AcpiExUnloadTable (
>
>
> /*
> + * Temporarily emit a warning so that the ASL for the machine can be
> + * hopefully obtained. This is to say that the Unload() operator is
> + * extremely rare if not completely unused.
> + */
> + ACPI_WARNING ((AE_INFO,
> + "Received request to unload an ACPI table"));
> +
> + /*
> * Validate the handle
> * Although the handle is partially validated in AcpiExReconfiguration()
> * when it calls AcpiExResolveOperands(), the handle is more completely
> diff --git a/src/acpica/source/components/executer/exdump.c b/src/acpica/source/components/executer/exdump.c
> index ec9f85d..7f66714 100644
> --- a/src/acpica/source/components/executer/exdump.c
> +++ b/src/acpica/source/components/executer/exdump.c
> @@ -227,10 +227,11 @@ static ACPI_EXDUMP_INFO AcpiExDumpMethod[9] =
> {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Method.AmlStart), "Aml Start"}
> };
>
> -static ACPI_EXDUMP_INFO AcpiExDumpMutex[5] =
> +static ACPI_EXDUMP_INFO AcpiExDumpMutex[6] =
> {
> {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE (AcpiExDumpMutex), NULL},
> {ACPI_EXD_UINT8, ACPI_EXD_OFFSET (Mutex.SyncLevel), "Sync Level"},
> + {ACPI_EXD_UINT8, ACPI_EXD_OFFSET (Mutex.OriginalSyncLevel), "Original Sync Level"},
> {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Mutex.OwnerThread), "Owner Thread"},
> {ACPI_EXD_UINT16, ACPI_EXD_OFFSET (Mutex.AcquisitionDepth), "Acquire Depth"},
> {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Mutex.OsMutex), "OsMutex"}
> diff --git a/src/acpica/source/components/tables/tbdata.c b/src/acpica/source/components/tables/tbdata.c
> new file mode 100755
> index 0000000..818637e
> --- /dev/null
> +++ b/src/acpica/source/components/tables/tbdata.c
> @@ -0,0 +1,888 @@
> +/******************************************************************************
> + *
> + * Module Name: tbdata - Table manager data structure functions
> + *
> + *****************************************************************************/
> +
> +/******************************************************************************
> + *
> + * 1. Copyright Notice
> + *
> + * Some or all of this work - Copyright (c) 1999 - 2014, Intel Corp.
> + * All rights reserved.
> + *
> + * 2. License
> + *
> + * 2.1. This is your license from Intel Corp. under its intellectual property
> + * rights. You may have additional license terms from the party that provided
> + * you this software, covering your right to use that party's intellectual
> + * property rights.
> + *
> + * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
> + * copy of the source code appearing in this file ("Covered Code") an
> + * irrevocable, perpetual, worldwide license under Intel's copyrights in the
> + * base code distributed originally by Intel ("Original Intel Code") to copy,
> + * make derivatives, distribute, use and display any portion of the Covered
> + * Code in any form, with the right to sublicense such rights; and
> + *
> + * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
> + * license (with the right to sublicense), under only those claims of Intel
> + * patents that are infringed by the Original Intel Code, to make, use, sell,
> + * offer to sell, and import the Covered Code and derivative works thereof
> + * solely to the minimum extent necessary to exercise the above copyright
> + * license, and in no event shall the patent license extend to any additions
> + * to or modifications of the Original Intel Code. No other license or right
> + * is granted directly or by implication, estoppel or otherwise;
> + *
> + * The above copyright and patent license is granted only if the following
> + * conditions are met:
> + *
> + * 3. Conditions
> + *
> + * 3.1. Redistribution of Source with Rights to Further Distribute Source.
> + * Redistribution of source code of any substantial portion of the Covered
> + * Code or modification with rights to further distribute source must include
> + * the above Copyright Notice, the above License, this list of Conditions,
> + * and the following Disclaimer and Export Compliance provision. In addition,
> + * Licensee must cause all Covered Code to which Licensee contributes to
> + * contain a file documenting the changes Licensee made to create that Covered
> + * Code and the date of any change. Licensee must include in that file the
> + * documentation of any changes made by any predecessor Licensee. Licensee
> + * must include a prominent statement that the modification is derived,
> + * directly or indirectly, from Original Intel Code.
> + *
> + * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
> + * Redistribution of source code of any substantial portion of the Covered
> + * Code or modification without rights to further distribute source must
> + * include the following Disclaimer and Export Compliance provision in the
> + * documentation and/or other materials provided with distribution. In
> + * addition, Licensee may not authorize further sublicense of source of any
> + * portion of the Covered Code, and must include terms to the effect that the
> + * license from Licensee to its licensee is limited to the intellectual
> + * property embodied in the software Licensee provides to its licensee, and
> + * not to intellectual property embodied in modifications its licensee may
> + * make.
> + *
> + * 3.3. Redistribution of Executable. Redistribution in executable form of any
> + * substantial portion of the Covered Code or modification must reproduce the
> + * above Copyright Notice, and the following Disclaimer and Export Compliance
> + * provision in the documentation and/or other materials provided with the
> + * distribution.
> + *
> + * 3.4. Intel retains all right, title, and interest in and to the Original
> + * Intel Code.
> + *
> + * 3.5. Neither the name Intel nor any other trademark owned or controlled by
> + * Intel shall be used in advertising or otherwise to promote the sale, use or
> + * other dealings in products derived from or relating to the Covered Code
> + * without prior written authorization from Intel.
> + *
> + * 4. Disclaimer and Export Compliance
> + *
> + * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
> + * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
> + * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
> + * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
> + * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
> + * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
> + * PARTICULAR PURPOSE.
> + *
> + * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
> + * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
> + * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
> + * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
> + * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
> + * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
> + * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
> + * LIMITED REMEDY.
> + *
> + * 4.3. Licensee shall not export, either directly or indirectly, any of this
> + * software or system incorporating such software without first obtaining any
> + * required license or other approval from the U. S. Department of Commerce or
> + * any other agency or department of the United States Government. In the
> + * event Licensee exports any such software from the United States or
> + * re-exports any such software from a foreign destination, Licensee shall
> + * ensure that the distribution and export/re-export of the software is in
> + * compliance with all laws, regulations, orders, or other restrictions of the
> + * U.S. Export Administration Regulations. Licensee agrees that neither it nor
> + * any of its subsidiaries will export/re-export any technical data, process,
> + * software, or service, directly or indirectly, to any country for which the
> + * United States government or any agency thereof requires an export license,
> + * other governmental approval, or letter of assurance, without first obtaining
> + * such license, approval or letter.
> + *
> + *****************************************************************************/
> +
> +#define __TBDATA_C__
> +
> +#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.
> + */
> + ACPI_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, 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, 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: AcpiTbVerifyTable
> + *
> + * 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
> +AcpiTbVerifyTable (
> + ACPI_TABLE_DESC *TableDesc,
> + char *Signature)
> +{
> + ACPI_STATUS Status = AE_OK;
> +
> +
> + ACPI_FUNCTION_TRACE (TbVerifyTable);
> +
> +
> + /* Validate the table */
> +
> + Status = AcpiTbValidateTable (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 */
> +
> + Status = AcpiTbVerifyChecksum (TableDesc->Pointer, TableDesc->Length);
> + if (ACPI_FAILURE (Status))
> + {
> + ACPI_EXCEPTION ((AE_INFO, AE_NO_MEMORY,
> + "%4.4s " ACPI_PRINTF_UINT
> + " Attempted table install failed",
> + AcpiUtValidAcpiName (TableDesc->Signature.Ascii) ?
> + TableDesc->Signature.Ascii : "????",
> + ACPI_FORMAT_TO_UINT (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)
> + {
> + ACPI_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: AcpiTbGetNextRootIndex
> + *
> + * PARAMETERS: TableIndex - Where table index is returned
> + *
> + * RETURN: Status and table index.
> + *
> + * DESCRIPTION: Allocate a new ACPI table entry to the global table list
> + *
> + ******************************************************************************/
> +
> +ACPI_STATUS
> +AcpiTbGetNextRootIndex (
> + UINT32 *TableIndex)
> +{
> + ACPI_STATUS Status;
> +
> +
> + /* 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);
> + }
> + }
> +
> + *TableIndex = AcpiGbl_RootTableList.CurrentTableCount;
> + AcpiGbl_RootTableList.CurrentTableCount++;
> + 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/src/acpica/source/components/tables/tbfadt.c b/src/acpica/source/components/tables/tbfadt.c
> index 0823e40..9809274 100644
> --- a/src/acpica/source/components/tables/tbfadt.c
> +++ b/src/acpica/source/components/tables/tbfadt.c
> @@ -437,14 +437,14 @@ AcpiTbParseFadt (
>
> /* Obtain the DSDT and FACS tables via their addresses within the FADT */
>
> - AcpiTbInstallTable ((ACPI_PHYSICAL_ADDRESS) AcpiGbl_FADT.XDsdt,
> + AcpiTbInstallFixedTable ((ACPI_PHYSICAL_ADDRESS) AcpiGbl_FADT.XDsdt,
> ACPI_SIG_DSDT, ACPI_TABLE_INDEX_DSDT);
>
> /* If Hardware Reduced flag is set, there is no FACS */
>
> if (!AcpiGbl_ReducedHardware)
> {
> - AcpiTbInstallTable ((ACPI_PHYSICAL_ADDRESS) AcpiGbl_FADT.XFacs,
> + AcpiTbInstallFixedTable ((ACPI_PHYSICAL_ADDRESS) AcpiGbl_FADT.XFacs,
> ACPI_SIG_FACS, ACPI_TABLE_INDEX_FACS);
> }
> }
> diff --git a/src/acpica/source/components/tables/tbfind.c b/src/acpica/source/components/tables/tbfind.c
> index 77dbf8f..42ce181 100644
> --- a/src/acpica/source/components/tables/tbfind.c
> +++ b/src/acpica/source/components/tables/tbfind.c
> @@ -180,7 +180,7 @@ AcpiTbFindTable (
> {
> /* Table is not currently mapped, map it */
>
> - Status = AcpiTbVerifyTable (&AcpiGbl_RootTableList.Tables[i]);
> + Status = AcpiTbValidateTable (&AcpiGbl_RootTableList.Tables[i]);
> if (ACPI_FAILURE (Status))
> {
> return_ACPI_STATUS (Status);
> diff --git a/src/acpica/source/components/tables/tbinstal.c b/src/acpica/source/components/tables/tbinstal.c
> index c2d9ad9..4560d0f 100644
> --- a/src/acpica/source/components/tables/tbinstal.c
> +++ b/src/acpica/source/components/tables/tbinstal.c
> @@ -113,779 +113,528 @@
> *
> *****************************************************************************/
>
> -
> #define __TBINSTAL_C__
>
> #include "acpi.h"
> #include "accommon.h"
> -#include "acnamesp.h"
> #include "actables.h"
>
> -
> #define _COMPONENT ACPI_TABLES
> ACPI_MODULE_NAME ("tbinstal")
>
> +/* Local prototypes */
>
> -/******************************************************************************
> +static BOOLEAN
> +AcpiTbCompareTables (
> + ACPI_TABLE_DESC *TableDesc,
> + UINT32 TableIndex);
> +
> +
> +/*******************************************************************************
> *
> - * FUNCTION: AcpiTbVerifyTable
> + * FUNCTION: AcpiTbCompareTables
> *
> - * PARAMETERS: TableDesc - table
> + * PARAMETERS: TableDesc - Table 1 descriptor to be compared
> + * TableIndex - Index of table 2 to be compared
> *
> - * RETURN: Status
> + * RETURN: TRUE if both tables are identical.
> *
> - * DESCRIPTION: this function is called to verify and map table
> + * DESCRIPTION: This function compares a table with another table that has
> + * already been installed in the root table list.
> *
> - *****************************************************************************/
> + ******************************************************************************/
>
> -ACPI_STATUS
> -AcpiTbVerifyTable (
> - ACPI_TABLE_DESC *TableDesc)
> +static BOOLEAN
> +AcpiTbCompareTables (
> + ACPI_TABLE_DESC *TableDesc,
> + UINT32 TableIndex)
> {
> ACPI_STATUS Status = AE_OK;
> + BOOLEAN IsIdentical;
> + ACPI_TABLE_HEADER *Table;
> + UINT32 TableLength;
> + UINT8 TableFlags;
>
>
> - ACPI_FUNCTION_TRACE (TbVerifyTable);
> -
> -
> - /* Map the table if necessary */
> -
> - if (!TableDesc->Pointer)
> + Status = AcpiTbAcquireTable (&AcpiGbl_RootTableList.Tables[TableIndex],
> + &Table, &TableLength, &TableFlags);
> + if (ACPI_FAILURE (Status))
> {
> - if ((TableDesc->Flags & ACPI_TABLE_ORIGIN_MASK) ==
> - ACPI_TABLE_ORIGIN_MAPPED)
> - {
> - TableDesc->Pointer = AcpiOsMapMemory (
> - TableDesc->Address, TableDesc->Length);
> - }
> -
> - if (!TableDesc->Pointer)
> - {
> - return_ACPI_STATUS (AE_NO_MEMORY);
> - }
> + return (FALSE);
> }
>
> - /* Always calculate checksum, ignore bad checksum if requested */
> + /*
> + * Check for a table match on the entire table length,
> + * not just the header.
> + */
> + IsIdentical = (BOOLEAN)((TableDesc->Length != TableLength ||
> + ACPI_MEMCMP (TableDesc->Pointer, Table, TableLength)) ?
> + FALSE : TRUE);
>
> - Status = AcpiTbVerifyChecksum (TableDesc->Pointer, TableDesc->Length);
> + /* Release the acquired table */
>
> - return_ACPI_STATUS (Status);
> + AcpiTbReleaseTable (Table, TableLength, TableFlags);
> + return (IsIdentical);
> }
>
>
> /*******************************************************************************
> *
> - * FUNCTION: AcpiTbAddTable
> + * FUNCTION: AcpiTbInstallTableWithOverride
> *
> - * PARAMETERS: TableDesc - Table descriptor
> - * TableIndex - Where the table index is returned
> + * PARAMETERS: TableIndex - Index into root table array
> + * NewTableDesc - New table descriptor to install
> + * Override - Whether override should be performed
> *
> - * RETURN: Status
> + * RETURN: None
> *
> - * DESCRIPTION: This function is called to add an ACPI table. It is used to
> - * dynamically load tables via the Load and LoadTable AML
> - * operators.
> + * 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.
> *
> ******************************************************************************/
>
> -ACPI_STATUS
> -AcpiTbAddTable (
> - ACPI_TABLE_DESC *TableDesc,
> - UINT32 *TableIndex)
> +void
> +AcpiTbInstallTableWithOverride (
> + UINT32 TableIndex,
> + ACPI_TABLE_DESC *NewTableDesc,
> + BOOLEAN Override)
> {
> - UINT32 i;
> - ACPI_STATUS Status = AE_OK;
> -
> -
> - ACPI_FUNCTION_TRACE (TbAddTable);
>
> -
> - if (!TableDesc->Pointer)
> + if (TableIndex >= AcpiGbl_RootTableList.CurrentTableCount)
> {
> - Status = AcpiTbVerifyTable (TableDesc);
> - if (ACPI_FAILURE (Status) || !TableDesc->Pointer)
> - {
> - return_ACPI_STATUS (Status);
> - }
> + return;
> }
>
> /*
> - * Validate the incoming table signature.
> + * ACPI Table Override:
> *
> - * 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).
> + * 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 ((TableDesc->Pointer->Signature[0] != 0x00) &&
> - (!ACPI_COMPARE_NAME (TableDesc->Pointer->Signature, ACPI_SIG_SSDT)) &&
> - (ACPI_STRNCMP (TableDesc->Pointer->Signature, "OEM", 3)))
> + if (Override)
> {
> - ACPI_BIOS_ERROR ((AE_INFO,
> - "Table has invalid signature [%4.4s] (0x%8.8X), "
> - "must be SSDT or OEMx",
> - AcpiUtValidAcpiName (TableDesc->Pointer->Signature) ?
> - TableDesc->Pointer->Signature : "????",
> - *(UINT32 *) TableDesc->Pointer->Signature));
> -
> - return_ACPI_STATUS (AE_BAD_SIGNATURE);
> + AcpiTbOverrideTable (NewTableDesc);
> }
>
> - (void) AcpiUtAcquireMutex (ACPI_MTX_TABLES);
> -
> - /* Check if table is already registered */
> -
> - for (i = 0; i < AcpiGbl_RootTableList.CurrentTableCount; ++i)
> - {
> - if (!AcpiGbl_RootTableList.Tables[i].Pointer)
> - {
> - Status = AcpiTbVerifyTable (&AcpiGbl_RootTableList.Tables[i]);
> - if (ACPI_FAILURE (Status) ||
> - !AcpiGbl_RootTableList.Tables[i].Pointer)
> - {
> - continue;
> - }
> - }
> -
> - /*
> - * Check for a table match on the entire table length,
> - * not just the header.
> - */
> - if (TableDesc->Length != AcpiGbl_RootTableList.Tables[i].Length)
> - {
> - continue;
> - }
> -
> - if (ACPI_MEMCMP (TableDesc->Pointer,
> - AcpiGbl_RootTableList.Tables[i].Pointer,
> - AcpiGbl_RootTableList.Tables[i].Length))
> - {
> - 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.
> - */
> -
> - /*
> - * Table is already registered.
> - * We can delete the table that was passed as a parameter.
> - */
> - AcpiTbDeleteTable (TableDesc);
> - *TableIndex = i;
> -
> - if (AcpiGbl_RootTableList.Tables[i].Flags & ACPI_TABLE_IS_LOADED)
> - {
> - /* Table is still loaded, this is an error */
> -
> - Status = AE_ALREADY_EXISTS;
> - goto Release;
> - }
> - else
> - {
> - /* Table was unloaded, allow it to be reloaded */
> -
> - TableDesc->Pointer = AcpiGbl_RootTableList.Tables[i].Pointer;
> - TableDesc->Address = AcpiGbl_RootTableList.Tables[i].Address;
> - Status = AE_OK;
> - goto PrintHeader;
> - }
> - }
> + AcpiTbInitTableDescriptor (&AcpiGbl_RootTableList.Tables[TableIndex],
> + NewTableDesc->Address, NewTableDesc->Flags, NewTableDesc->Pointer);
>
> - /*
> - * ACPI Table Override:
> - * Allow the host to override dynamically loaded tables.
> - * NOTE: the table is fully mapped at this point, and the mapping will
> - * be deleted by TbTableOverride if the table is actually overridden.
> - */
> - (void) AcpiTbTableOverride (TableDesc->Pointer, TableDesc);
> + AcpiTbPrintTableHeader (NewTableDesc->Address, NewTableDesc->Pointer);
>
> - /* Add the table to the global root table list */
> + /* Set the global integer width (based upon revision of the DSDT) */
>
> - Status = AcpiTbStoreTable (TableDesc->Address, TableDesc->Pointer,
> - TableDesc->Length, TableDesc->Flags, TableIndex);
> - if (ACPI_FAILURE (Status))
> + if (TableIndex == ACPI_TABLE_INDEX_DSDT)
> {
> - goto Release;
> + AcpiUtSetIntegerWidth (NewTableDesc->Pointer->Revision);
> }
> -
> -PrintHeader:
> - AcpiTbPrintTableHeader (TableDesc->Address, TableDesc->Pointer);
> -
> -Release:
> - (void) AcpiUtReleaseMutex (ACPI_MTX_TABLES);
> - return_ACPI_STATUS (Status);
> }
>
>
> /*******************************************************************************
> *
> - * FUNCTION: AcpiTbTableOverride
> + * FUNCTION: AcpiTbInstallFixedTable
> *
> - * PARAMETERS: TableHeader - Header for the original table
> - * TableDesc - Table descriptor initialized for the
> - * original table. May or may not be mapped.
> + * PARAMETERS: Address - Physical address of DSDT or FACS
> + * Signature - Table signature, NULL if no need to
> + * match
> + * TableIndex - Index into root table array
> *
> - * RETURN: Pointer to the entire new table. NULL if table not overridden.
> - * If overridden, installs the new table within the input table
> - * descriptor.
> + * RETURN: Status
> *
> - * DESCRIPTION: Attempt table override by calling the OSL override functions.
> - * Note: If the table is overridden, then the entire new table
> - * is mapped and returned by this function.
> + * DESCRIPTION: Install a fixed ACPI table (DSDT/FACS) into the global data
> + * structure.
> *
> ******************************************************************************/
>
> -ACPI_TABLE_HEADER *
> -AcpiTbTableOverride (
> - ACPI_TABLE_HEADER *TableHeader,
> - ACPI_TABLE_DESC *TableDesc)
> +ACPI_STATUS
> +AcpiTbInstallFixedTable (
> + ACPI_PHYSICAL_ADDRESS Address,
> + char *Signature,
> + UINT32 TableIndex)
> {
> + ACPI_TABLE_DESC NewTableDesc;
> ACPI_STATUS Status;
> - ACPI_TABLE_HEADER *NewTable = NULL;
> - ACPI_PHYSICAL_ADDRESS NewAddress = 0;
> - UINT32 NewTableLength = 0;
> - UINT8 NewFlags;
> - char *OverrideType;
>
>
> - /* (1) Attempt logical override (returns a logical address) */
> + ACPI_FUNCTION_TRACE (TbInstallFixedTable);
>
> - Status = AcpiOsTableOverride (TableHeader, &NewTable);
> - if (ACPI_SUCCESS (Status) && NewTable)
> +
> + if (!Address)
> {
> - NewAddress = ACPI_PTR_TO_PHYSADDR (NewTable);
> - NewTableLength = NewTable->Length;
> - NewFlags = ACPI_TABLE_ORIGIN_OVERRIDE;
> - OverrideType = "Logical";
> - goto FinishOverride;
> + ACPI_ERROR ((AE_INFO, "Null physical address for ACPI table [%s]",
> + Signature));
> + return (AE_NO_MEMORY);
> }
>
> - /* (2) Attempt physical override (returns a physical address) */
> + /* Fill a table descriptor for validation */
>
> - Status = AcpiOsPhysicalTableOverride (TableHeader,
> - &NewAddress, &NewTableLength);
> - if (ACPI_SUCCESS (Status) && NewAddress && NewTableLength)
> + Status = AcpiTbAcquireTempTable (&NewTableDesc, Address,
> + ACPI_TABLE_ORIGIN_INTERNAL_PHYSICAL);
> + if (ACPI_FAILURE (Status))
> {
> - /* Map the entire new table */
> -
> - NewTable = AcpiOsMapMemory (NewAddress, NewTableLength);
> - if (!NewTable)
> - {
> - ACPI_EXCEPTION ((AE_INFO, AE_NO_MEMORY,
> - "%4.4s " ACPI_PRINTF_UINT
> - " Attempted physical table override failed",
> - TableHeader->Signature,
> - ACPI_FORMAT_TO_UINT (TableDesc->Address)));
> - return (NULL);
> - }
> -
> - OverrideType = "Physical";
> - NewFlags = ACPI_TABLE_ORIGIN_MAPPED;
> - goto FinishOverride;
> + ACPI_ERROR ((AE_INFO, "Could not acquire table length at %p",
> + ACPI_CAST_PTR (void, Address)));
> + return_ACPI_STATUS (Status);
> }
>
> - return (NULL); /* There was no override */
> -
> -
> -FinishOverride:
> -
> - ACPI_INFO ((AE_INFO, "%4.4s " ACPI_PRINTF_UINT
> - " %s table override, new table: " ACPI_PRINTF_UINT,
> - TableHeader->Signature,
> - ACPI_FORMAT_TO_UINT (TableDesc->Address),
> - OverrideType, ACPI_FORMAT_TO_UINT (NewTable)));
> + /* Validate and verify a table before installation */
>
> - /* We can now unmap/delete the original table (if fully mapped) */
> + Status = AcpiTbVerifyTable (&NewTableDesc, Signature);
> + if (ACPI_FAILURE (Status))
> + {
> + goto ReleaseAndExit;
> + }
>
> - AcpiTbDeleteTable (TableDesc);
> + AcpiTbInstallTableWithOverride (TableIndex, &NewTableDesc, TRUE);
>
> - /* Setup descriptor for the new table */
> +ReleaseAndExit:
>
> - TableDesc->Address = NewAddress;
> - TableDesc->Pointer = NewTable;
> - TableDesc->Length = NewTableLength;
> - TableDesc->Flags = NewFlags;
> + /* Release the temporary table descriptor */
>
> - return (NewTable);
> + AcpiTbReleaseTempTable (&NewTableDesc);
> + return_ACPI_STATUS (Status);
> }
>
>
> /*******************************************************************************
> *
> - * FUNCTION: AcpiTbResizeRootTableList
> + * FUNCTION: AcpiTbInstallStandardTable
> *
> - * PARAMETERS: None
> + * 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: Expand the size of global table array
> + * 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
> -AcpiTbResizeRootTableList (
> - void)
> +AcpiTbInstallStandardTable (
> + ACPI_PHYSICAL_ADDRESS Address,
> + UINT8 Flags,
> + BOOLEAN Reload,
> + BOOLEAN Override,
> + UINT32 *TableIndex)
> {
> - ACPI_TABLE_DESC *Tables;
> - UINT32 TableCount;
> + UINT32 i;
> + ACPI_STATUS Status = AE_OK;
> + ACPI_TABLE_DESC NewTableDesc;
>
>
> - ACPI_FUNCTION_TRACE (TbResizeRootTableList);
> + ACPI_FUNCTION_TRACE (TbInstallStandardTable);
>
>
> - /* AllowResize flag is a parameter to AcpiInitializeTables */
> + /* Acquire a temporary table descriptor for validation */
>
> - if (!(AcpiGbl_RootTableList.Flags & ACPI_ROOT_ALLOW_RESIZE))
> + Status = AcpiTbAcquireTempTable (&NewTableDesc, Address, Flags);
> + if (ACPI_FAILURE (Status))
> {
> - ACPI_ERROR ((AE_INFO, "Resize of Root Table Array is not allowed"));
> - return_ACPI_STATUS (AE_SUPPORT);
> + ACPI_ERROR ((AE_INFO, "Could not acquire table length at %p",
> + ACPI_CAST_PTR (void, Address)));
> + return_ACPI_STATUS (Status);
> }
>
> - /* Increase the Table Array size */
> -
> - if (AcpiGbl_RootTableList.Flags & ACPI_ROOT_ORIGIN_ALLOCATED)
> - {
> - TableCount = AcpiGbl_RootTableList.MaxTableCount;
> - }
> - else
> + /*
> + * 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))
> {
> - TableCount = AcpiGbl_RootTableList.CurrentTableCount;
> + ACPI_INFO ((AE_INFO, "Ignoring installation of %4.4s at %p",
> + NewTableDesc.Signature.Ascii, ACPI_CAST_PTR (void, Address)));
> + goto ReleaseAndExit;
> }
>
> - Tables = ACPI_ALLOCATE_ZEROED (
> - ((ACPI_SIZE) TableCount + ACPI_ROOT_TABLE_SIZE_INCREMENT) *
> - sizeof (ACPI_TABLE_DESC));
> - if (!Tables)
> + /* Validate and verify a table before installation */
> +
> + Status = AcpiTbVerifyTable (&NewTableDesc, NULL);
> + if (ACPI_FAILURE (Status))
> {
> - ACPI_ERROR ((AE_INFO, "Could not allocate new root table array"));
> - return_ACPI_STATUS (AE_NO_MEMORY);
> + goto ReleaseAndExit;
> }
>
> - /* Copy and free the previous table array */
> -
> - if (AcpiGbl_RootTableList.Tables)
> + if (Reload)
> {
> - ACPI_MEMCPY (Tables, AcpiGbl_RootTableList.Tables,
> - (ACPI_SIZE) TableCount * sizeof (ACPI_TABLE_DESC));
> -
> - if (AcpiGbl_RootTableList.Flags & ACPI_ROOT_ORIGIN_ALLOCATED)
> + /*
> + * 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)) &&
> + (ACPI_STRNCMP (NewTableDesc.Signature.Ascii, "OEM", 3)))
> {
> - ACPI_FREE (AcpiGbl_RootTableList.Tables);
> + ACPI_BIOS_ERROR ((AE_INFO,
> + "Table has invalid signature [%4.4s] (0x%8.8X), "
> + "must be SSDT or OEMx",
> + AcpiUtValidAcpiName (NewTableDesc.Signature.Ascii) ?
> + NewTableDesc.Signature.Ascii : "????",
> + NewTableDesc.Signature.Integer));
> +
> + Status = AE_BAD_SIGNATURE;
> + goto ReleaseAndExit;
> }
> - }
> -
> - 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: AcpiTbStoreTable
> - *
> - * PARAMETERS: Address - Table address
> - * Table - Table header
> - * Length - Table length
> - * Flags - flags
> - *
> - * RETURN: Status and table index.
> - *
> - * DESCRIPTION: Add an ACPI table to the global table list
> - *
> - ******************************************************************************/
> -
> -ACPI_STATUS
> -AcpiTbStoreTable (
> - ACPI_PHYSICAL_ADDRESS Address,
> - ACPI_TABLE_HEADER *Table,
> - UINT32 Length,
> - UINT8 Flags,
> - UINT32 *TableIndex)
> -{
> - ACPI_STATUS Status;
> - ACPI_TABLE_DESC *NewTable;
> + /* 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;
> + }
>
> - /* Ensure that there is room for the table in the Root Table List */
> + /*
> + * 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 */
>
> - if (AcpiGbl_RootTableList.CurrentTableCount >=
> - AcpiGbl_RootTableList.MaxTableCount)
> - {
> - Status = AcpiTbResizeRootTableList();
> - if (ACPI_FAILURE (Status))
> - {
> - return (Status);
> + 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;
> + (void) AcpiUtReleaseMutex (ACPI_MTX_TABLES);
> + return_ACPI_STATUS (AE_OK);
> + }
> }
> }
>
> - NewTable = &AcpiGbl_RootTableList.Tables[AcpiGbl_RootTableList.CurrentTableCount];
> -
> - /* Initialize added table */
> -
> - NewTable->Address = Address;
> - NewTable->Pointer = Table;
> - NewTable->Length = Length;
> - NewTable->OwnerId = 0;
> - NewTable->Flags = Flags;
> -
> - ACPI_MOVE_32_TO_32 (&NewTable->Signature, Table->Signature);
> -
> - *TableIndex = AcpiGbl_RootTableList.CurrentTableCount;
> - AcpiGbl_RootTableList.CurrentTableCount++;
> - return (AE_OK);
> -}
> -
> -
> -/*******************************************************************************
> - *
> - * FUNCTION: AcpiTbDeleteTable
> - *
> - * PARAMETERS: TableIndex - Table index
> - *
> - * RETURN: None
> - *
> - * DESCRIPTION: Delete one internal ACPI table
> - *
> - ******************************************************************************/
> -
> -void
> -AcpiTbDeleteTable (
> - ACPI_TABLE_DESC *TableDesc)
> -{
> -
> - /* Table must be mapped or allocated */
> + /* Add the table to the global root table list */
>
> - if (!TableDesc->Pointer)
> + Status = AcpiTbGetNextRootIndex (&i);
> + if (ACPI_FAILURE (Status))
> {
> - return;
> + goto ReleaseAndExit;
> }
>
> - switch (TableDesc->Flags & ACPI_TABLE_ORIGIN_MASK)
> - {
> - case ACPI_TABLE_ORIGIN_MAPPED:
> -
> - AcpiOsUnmapMemory (TableDesc->Pointer, TableDesc->Length);
> - break;
> -
> - case ACPI_TABLE_ORIGIN_ALLOCATED:
> + *TableIndex = i;
> + AcpiTbInstallTableWithOverride (i, &NewTableDesc, Override);
>
> - ACPI_FREE (TableDesc->Pointer);
> - break;
> +ReleaseAndExit:
>
> - /* Not mapped or allocated, there is nothing we can do */
> + /* Release the temporary table descriptor */
>
> - default:
> -
> - return;
> - }
> -
> - TableDesc->Pointer = NULL;
> + AcpiTbReleaseTempTable (&NewTableDesc);
> + return_ACPI_STATUS (Status);
> }
>
>
> /*******************************************************************************
> *
> - * FUNCTION: AcpiTbTerminate
> + * FUNCTION: AcpiTbOverrideTable
> *
> - * PARAMETERS: None
> + * PARAMETERS: OldTableDesc - Validated table descriptor to be
> + * overridden
> *
> * RETURN: None
> *
> - * DESCRIPTION: Delete all internal ACPI tables
> + * 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
> -AcpiTbTerminate (
> - void)
> +AcpiTbOverrideTable (
> + ACPI_TABLE_DESC *OldTableDesc)
> {
> - UINT32 i;
> -
> -
> - ACPI_FUNCTION_TRACE (TbTerminate);
> -
> + ACPI_STATUS Status;
> + char *OverrideType;
> + ACPI_TABLE_DESC NewTableDesc;
> + ACPI_TABLE_HEADER *Table;
> + ACPI_PHYSICAL_ADDRESS Address;
> + UINT32 Length;
>
> - (void) AcpiUtAcquireMutex (ACPI_MTX_TABLES);
>
> - /* Delete the individual tables */
> + /* (1) Attempt logical override (returns a logical address) */
>
> - for (i = 0; i < AcpiGbl_RootTableList.CurrentTableCount; i++)
> + Status = AcpiOsTableOverride (OldTableDesc->Pointer, &Table);
> + if (ACPI_SUCCESS (Status) && Table)
> {
> - AcpiTbDeleteTable (&AcpiGbl_RootTableList.Tables[i]);
> + AcpiTbAcquireTempTable (&NewTableDesc, ACPI_PTR_TO_PHYSADDR (Table),
> + ACPI_TABLE_ORIGIN_EXTERNAL_VIRTUAL);
> + OverrideType = "Logical";
> + goto FinishOverride;
> }
>
> - /*
> - * 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)
> + /* (2) Attempt physical override (returns a physical address) */
> +
> + Status = AcpiOsPhysicalTableOverride (OldTableDesc->Pointer,
> + &Address, &Length);
> + if (ACPI_SUCCESS (Status) && Address && Length)
> {
> - ACPI_FREE (AcpiGbl_RootTableList.Tables);
> + AcpiTbAcquireTempTable (&NewTableDesc, Address,
> + ACPI_TABLE_ORIGIN_INTERNAL_PHYSICAL);
> + OverrideType = "Physical";
> + goto FinishOverride;
> }
>
> - 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;
> -}
> -
> + return; /* There was no override */
>
> -/*******************************************************************************
> - *
> - * 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);
> +FinishOverride:
>
> + /* Validate and verify a table before overriding */
>
> - Status = AcpiUtAcquireMutex (ACPI_MTX_TABLES);
> + Status = AcpiTbVerifyTable (&NewTableDesc, NULL);
> if (ACPI_FAILURE (Status))
> {
> - return_ACPI_STATUS (Status);
> + return;
> }
>
> - if (TableIndex >= AcpiGbl_RootTableList.CurrentTableCount)
> - {
> - /* The table index does not exist */
> -
> - (void) AcpiUtReleaseMutex (ACPI_MTX_TABLES);
> - return_ACPI_STATUS (AE_NOT_EXIST);
> - }
> + ACPI_INFO ((AE_INFO, "%4.4s " ACPI_PRINTF_UINT
> + " %s table override, new table: " ACPI_PRINTF_UINT,
> + OldTableDesc->Signature.Ascii,
> + ACPI_FORMAT_TO_UINT (OldTableDesc->Address),
> + OverrideType, ACPI_FORMAT_TO_UINT (NewTableDesc.Address)));
>
> - /* Get the owner ID for this table, used to delete namespace nodes */
> + /* We can now uninstall the original table */
>
> - OwnerId = AcpiGbl_RootTableList.Tables[TableIndex].OwnerId;
> - (void) AcpiUtReleaseMutex (ACPI_MTX_TABLES);
> + AcpiTbUninstallTable (OldTableDesc);
>
> /*
> - * 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.
> + * Replace the original table descriptor and keep its state as
> + * "VALIDATED".
> */
> - (void) AcpiUtReleaseMutex (ACPI_MTX_INTERPRETER);
> - Status = AcpiUtAcquireWriteLock (&AcpiGbl_NamespaceRwLock);
> -
> - AcpiNsDeleteNamespaceByOwner (OwnerId);
> - if (ACPI_FAILURE (Status))
> - {
> - return_ACPI_STATUS (Status);
> - }
> + AcpiTbInitTableDescriptor (OldTableDesc, NewTableDesc.Address,
> + NewTableDesc.Flags, NewTableDesc.Pointer);
> + AcpiTbValidateTable (OldTableDesc);
>
> - AcpiUtReleaseWriteLock (&AcpiGbl_NamespaceRwLock);
> + /* Release the temporary table descriptor */
>
> - Status = AcpiUtAcquireMutex (ACPI_MTX_INTERPRETER);
> - return_ACPI_STATUS (Status);
> + AcpiTbReleaseTempTable (&NewTableDesc);
> }
>
>
> /*******************************************************************************
> *
> - * FUNCTION: AcpiTbAllocateOwnerId
> + * FUNCTION: AcpiTbStoreTable
> *
> - * PARAMETERS: TableIndex - Table index
> + * PARAMETERS: Address - Table address
> + * Table - Table header
> + * Length - Table length
> + * Flags - Install flags
> + * TableIndex - Where the table index is returned
> *
> - * RETURN: Status
> + * RETURN: Status and table index.
> *
> - * DESCRIPTION: Allocates OwnerId in TableDesc
> + * DESCRIPTION: Add an ACPI table to the global table list
> *
> ******************************************************************************/
>
> ACPI_STATUS
> -AcpiTbAllocateOwnerId (
> - UINT32 TableIndex)
> +AcpiTbStoreTable (
> + ACPI_PHYSICAL_ADDRESS Address,
> + ACPI_TABLE_HEADER *Table,
> + UINT32 Length,
> + UINT8 Flags,
> + UINT32 *TableIndex)
> {
> - ACPI_STATUS Status = AE_BAD_PARAMETER;
> -
> -
> - ACPI_FUNCTION_TRACE (TbAllocateOwnerId);
> + ACPI_STATUS Status;
> + ACPI_TABLE_DESC *TableDesc;
>
>
> - (void) AcpiUtAcquireMutex (ACPI_MTX_TABLES);
> - if (TableIndex < AcpiGbl_RootTableList.CurrentTableCount)
> + Status = AcpiTbGetNextRootIndex (TableIndex);
> + if (ACPI_FAILURE (Status))
> {
> - Status = AcpiUtAllocateOwnerId
> - (&(AcpiGbl_RootTableList.Tables[TableIndex].OwnerId));
> + return (Status);
> }
>
> - (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;
> - }
> + /* Initialize added table */
>
> - (void) AcpiUtReleaseMutex (ACPI_MTX_TABLES);
> - return_ACPI_STATUS (Status);
> + TableDesc = &AcpiGbl_RootTableList.Tables[*TableIndex];
> + AcpiTbInitTableDescriptor (TableDesc, Address, Flags, Table);
> + TableDesc->Pointer = Table;
> + return (AE_OK);
> }
>
>
> /*******************************************************************************
> *
> - * FUNCTION: AcpiTbGetOwnerId
> + * FUNCTION: AcpiTbUninstallTable
> *
> - * PARAMETERS: TableIndex - Table index
> - * OwnerId - Where the table OwnerId is returned
> + * PARAMETERS: TableDesc - Table descriptor
> *
> - * RETURN: Status
> + * RETURN: None
> *
> - * DESCRIPTION: returns OwnerId for the ACPI table
> + * DESCRIPTION: Delete one internal ACPI table
> *
> ******************************************************************************/
>
> -ACPI_STATUS
> -AcpiTbGetOwnerId (
> - UINT32 TableIndex,
> - ACPI_OWNER_ID *OwnerId)
> +void
> +AcpiTbUninstallTable (
> + ACPI_TABLE_DESC *TableDesc)
> {
> - ACPI_STATUS Status = AE_BAD_PARAMETER;
>
> + ACPI_FUNCTION_TRACE (TbUninstallTable);
>
> - ACPI_FUNCTION_TRACE (TbGetOwnerId);
>
> + /* Table must be installed */
>
> - (void) AcpiUtAcquireMutex (ACPI_MTX_TABLES);
> - if (TableIndex < AcpiGbl_RootTableList.CurrentTableCount)
> + if (!TableDesc->Address)
> {
> - *OwnerId = AcpiGbl_RootTableList.Tables[TableIndex].OwnerId;
> - Status = AE_OK;
> + return_VOID;
> }
>
> - (void) AcpiUtReleaseMutex (ACPI_MTX_TABLES);
> - return_ACPI_STATUS (Status);
> -}
> -
> -
> -/*******************************************************************************
> - *
> - * FUNCTION: AcpiTbIsTableLoaded
> - *
> - * PARAMETERS: TableIndex - Table index
> - *
> - * RETURN: Table Loaded Flag
> - *
> - ******************************************************************************/
> -
> -BOOLEAN
> -AcpiTbIsTableLoaded (
> - UINT32 TableIndex)
> -{
> - BOOLEAN IsLoaded = FALSE;
> -
> + AcpiTbInvalidateTable (TableDesc);
>
> - (void) AcpiUtAcquireMutex (ACPI_MTX_TABLES);
> - if (TableIndex < AcpiGbl_RootTableList.CurrentTableCount)
> + if ((TableDesc->Flags & ACPI_TABLE_ORIGIN_MASK) ==
> + ACPI_TABLE_ORIGIN_INTERNAL_VIRTUAL)
> {
> - IsLoaded = (BOOLEAN)
> - (AcpiGbl_RootTableList.Tables[TableIndex].Flags &
> - ACPI_TABLE_IS_LOADED);
> + ACPI_FREE (ACPI_CAST_PTR (void, TableDesc->Address));
> }
>
> - (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);
> + TableDesc->Address = ACPI_PTR_TO_PHYSADDR (NULL);
> + return_VOID;
> }
> diff --git a/src/acpica/source/components/tables/tbutils.c b/src/acpica/source/components/tables/tbutils.c
> index 0d9375e..73cf76e 100644
> --- a/src/acpica/source/components/tables/tbutils.c
> +++ b/src/acpica/source/components/tables/tbutils.c
> @@ -269,9 +269,12 @@ AcpiTbCopyDsdt (
> }
>
> ACPI_MEMCPY (NewTable, TableDesc->Pointer, TableDesc->Length);
> - AcpiTbDeleteTable (TableDesc);
> - TableDesc->Pointer = NewTable;
> - TableDesc->Flags = ACPI_TABLE_ORIGIN_ALLOCATED;
> + AcpiTbUninstallTable (TableDesc);
> +
> + AcpiTbInitTableDescriptor (
> + &AcpiGbl_RootTableList.Tables[ACPI_TABLE_INDEX_DSDT],
> + ACPI_PTR_TO_PHYSADDR (NewTable), ACPI_TABLE_ORIGIN_INTERNAL_VIRTUAL,
> + NewTable);
>
> ACPI_INFO ((AE_INFO,
> "Forced DSDT copy: length 0x%05X copied locally, original unmapped",
> @@ -283,125 +286,6 @@ AcpiTbCopyDsdt (
>
> /*******************************************************************************
> *
> - * FUNCTION: AcpiTbInstallTable
> - *
> - * PARAMETERS: Address - Physical address of DSDT or FACS
> - * Signature - Table signature, NULL if no need to
> - * match
> - * TableIndex - Index into root table array
> - *
> - * 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
> -AcpiTbInstallTable (
> - ACPI_PHYSICAL_ADDRESS Address,
> - char *Signature,
> - UINT32 TableIndex)
> -{
> - ACPI_TABLE_HEADER *Table;
> - ACPI_TABLE_HEADER *FinalTable;
> - ACPI_TABLE_DESC *TableDesc;
> -
> -
> - if (!Address)
> - {
> - ACPI_ERROR ((AE_INFO, "Null physical address for ACPI table [%s]",
> - Signature));
> - return;
> - }
> -
> - /* Map just the table header */
> -
> - Table = AcpiOsMapMemory (Address, sizeof (ACPI_TABLE_HEADER));
> - if (!Table)
> - {
> - ACPI_ERROR ((AE_INFO, "Could not map memory for table [%s] at %p",
> - Signature, ACPI_CAST_PTR (void, Address)));
> - return;
> - }
> -
> - /* If a particular signature is expected (DSDT/FACS), it must match */
> -
> - if (Signature &&
> - !ACPI_COMPARE_NAME (Table->Signature, Signature))
> - {
> - ACPI_BIOS_ERROR ((AE_INFO,
> - "Invalid signature 0x%X for ACPI table, expected [%s]",
> - *ACPI_CAST_PTR (UINT32, Table->Signature), Signature));
> - goto UnmapAndExit;
> - }
> -
> - /*
> - * Initialize the table entry. Set the pointer to NULL, since the
> - * table is not fully mapped at this time.
> - */
> - TableDesc = &AcpiGbl_RootTableList.Tables[TableIndex];
> -
> - TableDesc->Address = Address;
> - TableDesc->Pointer = NULL;
> - TableDesc->Length = Table->Length;
> - TableDesc->Flags = ACPI_TABLE_ORIGIN_MAPPED;
> - ACPI_MOVE_32_TO_32 (TableDesc->Signature.Ascii, Table->Signature);
> -
> - /*
> - * 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.
> - *
> - * NOTE: If the table is overridden, then FinalTable will contain a
> - * mapped pointer to the full new table. If the table is not overridden,
> - * or if there has been a physical override, then the table will be
> - * fully mapped later (in verify table). In any case, we must
> - * unmap the header that was mapped above.
> - */
> - FinalTable = AcpiTbTableOverride (Table, TableDesc);
> - if (!FinalTable)
> - {
> - FinalTable = Table; /* There was no override */
> - }
> -
> - AcpiTbPrintTableHeader (TableDesc->Address, FinalTable);
> -
> - /* Set the global integer width (based upon revision of the DSDT) */
> -
> - if (TableIndex == ACPI_TABLE_INDEX_DSDT)
> - {
> - AcpiUtSetIntegerWidth (FinalTable->Revision);
> - }
> -
> - /*
> - * If we have a physical override during this early loading of the ACPI
> - * tables, unmap the table for now. It will be mapped again later when
> - * it is actually used. This supports very early loading of ACPI tables,
> - * before virtual memory is fully initialized and running within the
> - * host OS. Note: A logical override has the ACPI_TABLE_ORIGIN_OVERRIDE
> - * flag set and will not be deleted below.
> - */
> - if (FinalTable != Table)
> - {
> - AcpiTbDeleteTable (TableDesc);
> - }
> -
> -
> -UnmapAndExit:
> -
> - /* Always unmap the table header that we mapped above */
> -
> - AcpiOsUnmapMemory (Table, sizeof (ACPI_TABLE_HEADER));
> -}
> -
> -
> -/*******************************************************************************
> - *
> * FUNCTION: AcpiTbGetRootTableEntry
> *
> * PARAMETERS: TableEntry - Pointer to the RSDT/XSDT table entry
> @@ -578,6 +462,7 @@ AcpiTbParseRootTable (
> UINT32 Length;
> UINT8 *TableEntry;
> ACPI_STATUS Status;
> + UINT32 TableIndex;
>
>
> ACPI_FUNCTION_TRACE (TbParseRootTable);
> @@ -697,28 +582,20 @@ AcpiTbParseRootTable (
>
> for (i = 0; i < TableCount; i++)
> {
> - if (AcpiGbl_RootTableList.CurrentTableCount >=
> - AcpiGbl_RootTableList.MaxTableCount)
> - {
> - /* There is no more room in the root table array, attempt resize */
> -
> - Status = AcpiTbResizeRootTableList ();
> - if (ACPI_FAILURE (Status))
> - {
> - ACPI_WARNING ((AE_INFO, "Truncating %u table entries!",
> - (unsigned) (TableCount -
> - (AcpiGbl_RootTableList.CurrentTableCount - 2))));
> - break;
> - }
> - }
> -
> /* Get the table physical address (32-bit for RSDT, 64-bit for XSDT) */
>
> - AcpiGbl_RootTableList.Tables[AcpiGbl_RootTableList.CurrentTableCount].Address =
> - AcpiTbGetRootTableEntry (TableEntry, TableEntrySize);
> + Status = AcpiTbInstallStandardTable (
> + AcpiTbGetRootTableEntry (TableEntry, TableEntrySize),
> + ACPI_TABLE_ORIGIN_INTERNAL_PHYSICAL, FALSE, TRUE, &TableIndex);
> +
> + if (ACPI_SUCCESS (Status) &&
> + ACPI_COMPARE_NAME (&AcpiGbl_RootTableList.Tables[TableIndex].Signature,
> + ACPI_SIG_FADT))
> + {
> + AcpiTbParseFadt (TableIndex);
> + }
>
> TableEntry += TableEntrySize;
> - AcpiGbl_RootTableList.CurrentTableCount++;
> }
>
> /*
> @@ -727,23 +604,5 @@ AcpiTbParseRootTable (
> */
> AcpiOsUnmapMemory (Table, Length);
>
> - /*
> - * Complete the initialization of the root table array by examining
> - * the header of each table
> - */
> - for (i = 2; i < AcpiGbl_RootTableList.CurrentTableCount; i++)
> - {
> - AcpiTbInstallTable (AcpiGbl_RootTableList.Tables[i].Address,
> - NULL, i);
> -
> - /* Special case for FADT - validate it then get the DSDT and FACS */
> -
> - if (ACPI_COMPARE_NAME (
> - &AcpiGbl_RootTableList.Tables[i].Signature, ACPI_SIG_FADT))
> - {
> - AcpiTbParseFadt (i);
> - }
> - }
> -
> return_ACPI_STATUS (AE_OK);
> }
> diff --git a/src/acpica/source/components/tables/tbxface.c b/src/acpica/source/components/tables/tbxface.c
> index 01274ce..cbdede5 100644
> --- a/src/acpica/source/components/tables/tbxface.c
> +++ b/src/acpica/source/components/tables/tbxface.c
> @@ -334,7 +334,7 @@ AcpiGetTableHeader (
> {
> if ((AcpiGbl_RootTableList.Tables[i].Flags &
> ACPI_TABLE_ORIGIN_MASK) ==
> - ACPI_TABLE_ORIGIN_MAPPED)
> + ACPI_TABLE_ORIGIN_INTERNAL_PHYSICAL)
> {
> Header = AcpiOsMapMemory (
> AcpiGbl_RootTableList.Tables[i].Address,
> @@ -417,7 +417,7 @@ AcpiGetTable (
> continue;
> }
>
> - Status = AcpiTbVerifyTable (&AcpiGbl_RootTableList.Tables[i]);
> + Status = AcpiTbValidateTable (&AcpiGbl_RootTableList.Tables[i]);
> if (ACPI_SUCCESS (Status))
> {
> *OutTable = AcpiGbl_RootTableList.Tables[i].Pointer;
> @@ -478,7 +478,7 @@ AcpiGetTableByIndex (
> {
> /* Table is not mapped, map it */
>
> - Status = AcpiTbVerifyTable (&AcpiGbl_RootTableList.Tables[TableIndex]);
> + Status = AcpiTbValidateTable (&AcpiGbl_RootTableList.Tables[TableIndex]);
> if (ACPI_FAILURE (Status))
> {
> (void) AcpiUtReleaseMutex (ACPI_MTX_TABLES);
> diff --git a/src/acpica/source/components/tables/tbxfload.c b/src/acpica/source/components/tables/tbxfload.c
> index 4f74333..77c1be6 100644
> --- a/src/acpica/source/components/tables/tbxfload.c
> +++ b/src/acpica/source/components/tables/tbxfload.c
> @@ -203,7 +203,7 @@ AcpiTbLoadNamespace (
> !ACPI_COMPARE_NAME (
> &(AcpiGbl_RootTableList.Tables[ACPI_TABLE_INDEX_DSDT].Signature),
> ACPI_SIG_DSDT) ||
> - ACPI_FAILURE (AcpiTbVerifyTable (
> + ACPI_FAILURE (AcpiTbValidateTable (
> &AcpiGbl_RootTableList.Tables[ACPI_TABLE_INDEX_DSDT])))
> {
> Status = AE_NO_ACPI_TABLES;
> @@ -214,7 +214,7 @@ AcpiTbLoadNamespace (
> * 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 AcpiTbVerifyTable.
> + * .Pointer field is not validated until after call to AcpiTbValidateTable.
> */
> AcpiGbl_DSDT = AcpiGbl_RootTableList.Tables[ACPI_TABLE_INDEX_DSDT].Pointer;
>
> @@ -259,24 +259,12 @@ AcpiTbLoadNamespace (
> ACPI_SIG_SSDT) &&
> !ACPI_COMPARE_NAME (&(AcpiGbl_RootTableList.Tables[i].Signature),
> ACPI_SIG_PSDT)) ||
> - ACPI_FAILURE (AcpiTbVerifyTable (
> + ACPI_FAILURE (AcpiTbValidateTable (
> &AcpiGbl_RootTableList.Tables[i])))
> {
> continue;
> }
>
> - /*
> - * Optionally do not load any SSDTs from the RSDT/XSDT. This can
> - * be useful for debugging ACPI problems on some machines.
> - */
> - if (AcpiGbl_DisableSsdtTableLoad)
> - {
> - ACPI_INFO ((AE_INFO, "Ignoring %4.4s at %p",
> - AcpiGbl_RootTableList.Tables[i].Signature.Ascii,
> - ACPI_CAST_PTR (void, AcpiGbl_RootTableList.Tables[i].Address)));
> - continue;
> - }
> -
> /* Ignore errors while loading tables, get as many as possible */
>
> (void) AcpiUtReleaseMutex (ACPI_MTX_TABLES);
> @@ -294,6 +282,53 @@ UnlockAndExit:
>
> /*******************************************************************************
> *
> + * 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_EXTERNAL_VIRTUAL;
> + }
> + else
> + {
> + Flags = ACPI_TABLE_ORIGIN_INTERNAL_PHYSICAL;
> + }
> +
> + 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
> @@ -314,7 +349,6 @@ AcpiLoadTable (
> ACPI_TABLE_HEADER *Table)
> {
> ACPI_STATUS Status;
> - ACPI_TABLE_DESC TableDesc;
> UINT32 TableIndex;
>
>
> @@ -328,14 +362,6 @@ AcpiLoadTable (
> return_ACPI_STATUS (AE_BAD_PARAMETER);
> }
>
> - /* Init local table descriptor */
> -
> - ACPI_MEMSET (&TableDesc, 0, sizeof (ACPI_TABLE_DESC));
> - TableDesc.Address = ACPI_PTR_TO_PHYSADDR (Table);
> - TableDesc.Pointer = Table;
> - TableDesc.Length = Table->Length;
> - TableDesc.Flags = ACPI_TABLE_ORIGIN_UNKNOWN;
> -
> /* Must acquire the interpreter lock during this operation */
>
> Status = AcpiUtAcquireMutex (ACPI_MTX_INTERPRETER);
> @@ -347,7 +373,23 @@ AcpiLoadTable (
> /* Install the table and load it into the namespace */
>
> ACPI_INFO ((AE_INFO, "Host-directed Dynamic ACPI Table Load:"));
> - Status = AcpiTbAddTable (&TableDesc, &TableIndex);
> + (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;
> diff --git a/src/acpica/source/components/utilities/utdecode.c b/src/acpica/source/components/utilities/utdecode.c
> index 2501f1a..8566819 100644
> --- a/src/acpica/source/components/utilities/utdecode.c
> +++ b/src/acpica/source/components/utilities/utdecode.c
> @@ -599,7 +599,7 @@ AcpiUtGetMutexName (
>
> /* Names for Notify() values, used for debug output */
>
> -static const char *AcpiGbl_NotifyValueNames[ACPI_NOTIFY_MAX + 1] =
> +static const char *AcpiGbl_GenericNotify[ACPI_NOTIFY_MAX + 1] =
> {
> /* 00 */ "Bus Check",
> /* 01 */ "Device Check",
> @@ -611,32 +611,87 @@ static const char *AcpiGbl_NotifyValueNames[ACPI_NOTIFY_MAX + 1] =
> /* 07 */ "Power Fault",
> /* 08 */ "Capabilities Check",
> /* 09 */ "Device PLD Check",
> - /* 10 */ "Reserved",
> - /* 11 */ "System Locality Update",
> - /* 12 */ "Shutdown Request"
> + /* 0A */ "Reserved",
> + /* 0B */ "System Locality Update",
> + /* 0C */ "Shutdown Request"
> };
>
> +static const char *AcpiGbl_DeviceNotify[4] =
> +{
> + /* 80 */ "Status Change",
> + /* 81 */ "Information Change",
> + /* 82 */ "Device-Specific Change",
> + /* 83 */ "Device-Specific Change"
> +};
> +
> +static const char *AcpiGbl_ProcessorNotify[4] =
> +{
> + /* 80 */ "Performance Capability Change",
> + /* 81 */ "C-State Change",
> + /* 82 */ "Throttling Capability Change",
> + /* 83 */ "Device-Specific Change"
> +};
> +
> +static const char *AcpiGbl_ThermalNotify[4] =
> +{
> + /* 80 */ "Thermal Status Change",
> + /* 81 */ "Thermal Trip Point Change",
> + /* 82 */ "Thermal Device List Change",
> + /* 83 */ "Thermal Relationship Change"
> +};
> +
> +
> const char *
> AcpiUtGetNotifyName (
> - UINT32 NotifyValue)
> + UINT32 NotifyValue,
> + ACPI_OBJECT_TYPE Type)
> {
>
> + /* 00 - 0C are common to all object types */
> +
> if (NotifyValue <= ACPI_NOTIFY_MAX)
> {
> - return (AcpiGbl_NotifyValueNames[NotifyValue]);
> + return (AcpiGbl_GenericNotify[NotifyValue]);
> }
> - else if (NotifyValue <= ACPI_MAX_SYS_NOTIFY)
> +
> + /* 0D - 7F are reserved */
> +
> + if (NotifyValue <= ACPI_MAX_SYS_NOTIFY)
> {
> return ("Reserved");
> }
> - else if (NotifyValue <= ACPI_MAX_DEVICE_SPECIFIC_NOTIFY)
> +
> + /* 80 - 83 are per-object-type */
> +
> + if (NotifyValue <= 0x83)
> {
> - return ("Device Specific");
> + switch (Type)
> + {
> + case ACPI_TYPE_ANY:
> + case ACPI_TYPE_DEVICE:
> + return (AcpiGbl_DeviceNotify [NotifyValue - 0x80]);
> +
> + case ACPI_TYPE_PROCESSOR:
> + return (AcpiGbl_ProcessorNotify [NotifyValue - 0x80]);
> +
> + case ACPI_TYPE_THERMAL:
> + return (AcpiGbl_ThermalNotify [NotifyValue - 0x80]);
> +
> + default:
> + return ("Target object type does not support notifies");
> + }
> }
> - else
> +
> + /* 84 - BF are device-specific */
> +
> + if (NotifyValue <= ACPI_MAX_DEVICE_SPECIFIC_NOTIFY)
> {
> - return ("Hardware Specific");
> + return ("Device-Specific");
> }
> +
> + /* C0 and above are hardware-specific */
> +
> + return ("Hardware-Specific");
> }
> #endif
>
> diff --git a/src/acpica/source/components/utilities/utstring.c b/src/acpica/source/components/utilities/utstring.c
> index 730d961..c4ead02 100644
> --- a/src/acpica/source/components/utilities/utstring.c
> +++ b/src/acpica/source/components/utilities/utstring.c
> @@ -492,7 +492,7 @@ AcpiUtPrintString (
> }
>
> AcpiOsPrintf ("\"");
> - for (i = 0; String[i] && (i < MaxLength); i++)
> + for (i = 0; (i < MaxLength) && String[i]; i++)
> {
> /* Escape sequences */
>
> diff --git a/src/acpica/source/include/acapps.h b/src/acpica/source/include/acapps.h
> index cd36274..63f879e 100644
> --- a/src/acpica/source/include/acapps.h
> +++ b/src/acpica/source/include/acapps.h
> @@ -117,8 +117,6 @@
> #define _ACAPPS
>
>
> -#pragma pack(push) /* Set default struct packing */
> -
> #ifdef _MSC_VER /* disable some level-4 warnings */
> #pragma warning(disable:4100) /* warning C4100: unreferenced formal parameter */
> #endif
> @@ -188,6 +186,14 @@ extern int AcpiGbl_SubOptChar;
> extern char *AcpiGbl_Optarg;
>
>
> +/*
> + * cmfsize - Common get file size function
> + */
> +UINT32
> +CmGetFileSize (
> + FILE *File);
> +
> +
> #ifndef ACPI_DUMP_APP
> /*
> * adisasm
> @@ -293,6 +299,4 @@ AdWriteTable (
> char *OemTableId);
> #endif
>
> -#pragma pack(pop) /* Restore original struct packing */
> -
> #endif /* _ACAPPS */
> diff --git a/src/acpica/source/include/acbuffer.h b/src/acpica/source/include/acbuffer.h
> index d6163f3..3228bca 100644
> --- a/src/acpica/source/include/acbuffer.h
> +++ b/src/acpica/source/include/acbuffer.h
> @@ -116,9 +116,6 @@
> #ifndef __ACBUFFER_H__
> #define __ACBUFFER_H__
>
> -
> -#pragma pack(push) /* Set default struct packing */
> -
> /*
> * Contains buffer structures for these predefined names:
> * _FDE, _GRT, _GTM, _PLD, _SRT
> @@ -318,6 +315,4 @@ typedef struct acpi_pld_info
> #define ACPI_PLD_SET_HORIZ_OFFSET(dword,value) ACPI_SET_BITS (dword, 16, ACPI_16BIT_MASK, value) /* Offset 128+16=144, Len 16 */
>
>
> -#pragma pack(pop) /* Restore original struct packing */
> -
> #endif /* ACBUFFER_H */
> diff --git a/src/acpica/source/include/acconfig.h b/src/acpica/source/include/acconfig.h
> index b57526a..6b34484 100644
> --- a/src/acpica/source/include/acconfig.h
> +++ b/src/acpica/source/include/acconfig.h
> @@ -117,8 +117,6 @@
> #define _ACCONFIG_H
>
>
> -#pragma pack(push) /* Set default struct packing */
> -
> /******************************************************************************
> *
> * Configuration options
> @@ -308,6 +306,4 @@
> #define ACPI_DEBUGGER_EXECUTE_PROMPT '%'
>
>
> -#pragma pack(pop) /* Restore original struct packing */
> -
> #endif /* _ACCONFIG_H */
> diff --git a/src/acpica/source/include/acdebug.h b/src/acpica/source/include/acdebug.h
> index 824bf2a..1807c31 100644
> --- a/src/acpica/source/include/acdebug.h
> +++ b/src/acpica/source/include/acdebug.h
> @@ -117,8 +117,6 @@
> #define __ACDEBUG_H__
>
>
> -#pragma pack(push) /* Set default struct packing */
> -
> #define ACPI_DEBUG_BUFFER_SIZE 0x4000 /* 16K buffer for return objects */
>
> typedef struct acpi_db_command_info
> @@ -540,6 +538,4 @@ AcpiDbUint32ToHexString (
> UINT32 Value,
> char *Buffer);
>
> -#pragma pack(pop) /* Restore original struct packing */
> -
> #endif /* __ACDEBUG_H__ */
> diff --git a/src/acpica/source/include/acdisasm.h b/src/acpica/source/include/acdisasm.h
> index 9814e21..df8d2e7 100644
> --- a/src/acpica/source/include/acdisasm.h
> +++ b/src/acpica/source/include/acdisasm.h
> @@ -119,8 +119,6 @@
> #include "amlresrc.h"
>
>
> -#pragma pack(push) /* Set default struct packing */
> -
> #define BLOCK_NONE 0
> #define BLOCK_PAREN 1
> #define BLOCK_BRACE 2
> @@ -626,6 +624,14 @@ AcpiDmMethodFlags (
> ACPI_PARSE_OBJECT *Op);
>
> void
> +AcpiDmDisplayTargetPathname (
> + ACPI_PARSE_OBJECT *Op);
> +
> +void
> +AcpiDmNotifyDescription (
> + ACPI_PARSE_OBJECT *Op);
> +
> +void
> AcpiDmPredefinedDescription (
> ACPI_PARSE_OBJECT *Op);
>
> @@ -705,11 +711,11 @@ AcpiDmByteList (
> ACPI_PARSE_OBJECT *Op);
>
> void
> -AcpiDmIsEisaId (
> +AcpiDmCheckForHardwareId (
> ACPI_PARSE_OBJECT *Op);
>
> void
> -AcpiDmEisaId (
> +AcpiDmDecompressEisaId (
> UINT32 EncodedId);
>
> BOOLEAN
> @@ -1003,6 +1009,4 @@ AdDisassemblerHeader (
> char *Filename);
>
>
> -#pragma pack(pop) /* Restore original struct packing */
> -
> #endif /* __ACDISASM_H__ */
> diff --git a/src/acpica/source/include/acdispat.h b/src/acpica/source/include/acdispat.h
> index f3fac95..bfccbf1 100644
> --- a/src/acpica/source/include/acdispat.h
> +++ b/src/acpica/source/include/acdispat.h
> @@ -118,8 +118,6 @@
> #define _ACDISPAT_H_
>
>
> -#pragma pack(push) /* Set default struct packing */
> -
> #define NAMEOF_LOCAL_NTE "__L0"
> #define NAMEOF_ARG_NTE "__A0"
>
> @@ -536,6 +534,4 @@ AcpiDsResultPush (
> ACPI_OPERAND_OBJECT *Object,
> ACPI_WALK_STATE *WalkState);
>
> -#pragma pack(pop) /* Restore original struct packing */
> -
> #endif /* _ACDISPAT_H_ */
> diff --git a/src/acpica/source/include/acevents.h b/src/acpica/source/include/acevents.h
> index f895ccb..731defb 100644
> --- a/src/acpica/source/include/acevents.h
> +++ b/src/acpica/source/include/acevents.h
> @@ -117,8 +117,6 @@
> #define __ACEVENTS_H__
>
>
> -#pragma pack(push) /* Set default struct packing */
> -
> /*
> * evevent
> */
> @@ -430,6 +428,4 @@ void
> AcpiEvTerminate (
> void))
>
> -#pragma pack(pop) /* Restore original struct packing */
> -
> #endif /* __ACEVENTS_H__ */
> diff --git a/src/acpica/source/include/acexcep.h b/src/acpica/source/include/acexcep.h
> index 807f4e3..89d9852 100644
> --- a/src/acpica/source/include/acexcep.h
> +++ b/src/acpica/source/include/acexcep.h
> @@ -117,8 +117,6 @@
> #define __ACEXCEP_H__
>
>
> -#pragma pack(push) /* Set default struct packing */
> -
> /* This module contains all possible exception codes for ACPI_STATUS */
>
> /*
> @@ -419,6 +417,4 @@ static const ACPI_EXCEPTION_INFO AcpiGbl_ExceptionNames_Ctrl[] =
>
> #endif /* EXCEPTION_TABLE */
>
> -#pragma pack(pop) /* Restore original struct packing */
> -
> #endif /* __ACEXCEP_H__ */
> diff --git a/src/acpica/source/include/acglobal.h b/src/acpica/source/include/acglobal.h
> index 8ecdf04..a3ae36a 100644
> --- a/src/acpica/source/include/acglobal.h
> +++ b/src/acpica/source/include/acglobal.h
> @@ -117,8 +117,6 @@
> #define __ACGLOBAL_H__
>
>
> -#pragma pack(push) /* Set default struct packing */
> -
> /*
> * Ensure that the globals are actually defined and initialized only once.
> *
> @@ -179,8 +177,8 @@ ACPI_INIT_GLOBAL (UINT8, AcpiGbl_AutoSerializeMethods, TRUE);
>
> /*
> * Create the predefined _OSI method in the namespace? Default is TRUE
> - * because ACPI CA is fully compatible with other ACPI implementations.
> - * Changing this will revert ACPI CA (and machine ASL) to pre-OSI behavior.
> + * because ACPICA is fully compatible with other ACPI implementations.
> + * Changing this will revert ACPICA (and machine ASL) to pre-OSI behavior.
> */
> ACPI_INIT_GLOBAL (UINT8, AcpiGbl_CreateOsiMethod, TRUE);
>
> @@ -236,10 +234,10 @@ ACPI_INIT_GLOBAL (UINT8, AcpiGbl_TruncateIoAddresses, FALSE);
> ACPI_INIT_GLOBAL (UINT8, AcpiGbl_DisableAutoRepair, FALSE);
>
> /*
> - * Optionally do not load any SSDTs from the RSDT/XSDT during initialization.
> + * Optionally do not install any SSDTs from the RSDT/XSDT during initialization.
> * This can be useful for debugging ACPI problems on some machines.
> */
> -ACPI_INIT_GLOBAL (UINT8, AcpiGbl_DisableSsdtTableLoad, FALSE);
> +ACPI_INIT_GLOBAL (UINT8, AcpiGbl_DisableSsdtTableInstall, FALSE);
>
> /*
> * We keep track of the latest version of Windows that has been requested by
> @@ -434,7 +432,7 @@ ACPI_GLOBAL (UINT32, AcpiGbl_MaxConcurrentNodeCount);
> ACPI_GLOBAL (ACPI_SIZE *, AcpiGbl_EntryStackPointer);
> ACPI_GLOBAL (ACPI_SIZE *, AcpiGbl_LowestStackPointer);
> ACPI_GLOBAL (UINT32, AcpiGbl_DeepestNesting);
> -ACPI_INIT_GLOBAL (UINT32, AcpiGbl_NestingLevel, 0);
> +ACPI_INIT_GLOBAL (UINT32, AcpiGbl_NestingLevel, 0);
> #endif
>
>
> @@ -591,8 +589,7 @@ ACPI_INIT_GLOBAL (ACPI_FILE, AcpiGbl_DebugFile, NULL);
> ****************************************************************************/
>
> extern const AH_PREDEFINED_NAME AslPredefinedInfo[];
> +extern const AH_DEVICE_ID AslDeviceIds[];
>
>
> -#pragma pack(pop) /* Restore original struct packing */
> -
> #endif /* __ACGLOBAL_H__ */
> diff --git a/src/acpica/source/include/achware.h b/src/acpica/source/include/achware.h
> index 7ac74db..ed39a36 100644
> --- a/src/acpica/source/include/achware.h
> +++ b/src/acpica/source/include/achware.h
> @@ -117,8 +117,6 @@
> #define __ACHWARE_H__
>
>
> -#pragma pack(push) /* Set default struct packing */
> -
> /* Values for the _SST predefined method */
>
> #define ACPI_SST_INDICATOR_OFF 0
> @@ -298,6 +296,4 @@ AcpiHwDerivePciId (
> ACPI_HANDLE PciRegion);
>
>
> -#pragma pack(pop) /* Restore original struct packing */
> -
> #endif /* __ACHWARE_H__ */
> diff --git a/src/acpica/source/include/acinterp.h b/src/acpica/source/include/acinterp.h
> index 497a4e2..739a0de 100644
> --- a/src/acpica/source/include/acinterp.h
> +++ b/src/acpica/source/include/acinterp.h
> @@ -117,8 +117,6 @@
> #define __ACINTERP_H__
>
>
> -#pragma pack(push) /* Set default struct packing */
> -
> #define ACPI_WALK_OPERANDS (&(WalkState->Operands [WalkState->NumOperands -1]))
>
> /* Macros for tables used for debug output */
> @@ -793,6 +791,4 @@ AcpiExDataTableSpaceHandler (
> void *HandlerContext,
> void *RegionContext);
>
> -#pragma pack(pop) /* Restore original struct packing */
> -
> #endif /* __INTERP_H__ */
> diff --git a/src/acpica/source/include/aclocal.h b/src/acpica/source/include/aclocal.h
> index 9c8cc99..147d0fb 100644
> --- a/src/acpica/source/include/aclocal.h
> +++ b/src/acpica/source/include/aclocal.h
> @@ -117,8 +117,6 @@
> #define __ACLOCAL_H__
>
>
> -#pragma pack(push) /* Set default struct packing */
> -
> /* acpisrc:StructDefs -- for acpisrc conversion */
>
> #define ACPI_SERIALIZED 0xFF
> @@ -955,7 +953,8 @@ typedef union acpi_parse_value
> #define ACPI_DASM_MATCHOP 0x06 /* Parent opcode is a Match() operator */
> #define ACPI_DASM_LNOT_PREFIX 0x07 /* Start of a LNotEqual (etc.) pair of opcodes */
> #define ACPI_DASM_LNOT_SUFFIX 0x08 /* End of a LNotEqual (etc.) pair of opcodes */
> -#define ACPI_DASM_IGNORE 0x09 /* Not used at this time */
> +#define ACPI_DASM_HID_STRING 0x09 /* String is a _HID or _CID */
> +#define ACPI_DASM_IGNORE 0x0A /* Not used at this time */
>
> /*
> * Generic operation (for example: If, While, Store)
> @@ -1423,6 +1422,11 @@ typedef struct ah_predefined_name
>
> } AH_PREDEFINED_NAME;
>
> -#pragma pack(pop) /* Restore original struct packing */
> +typedef struct ah_device_id
> +{
> + char *Name;
> + char *Description;
> +
> +} AH_DEVICE_ID;
>
> #endif /* __ACLOCAL_H__ */
> diff --git a/src/acpica/source/include/acmacros.h b/src/acpica/source/include/acmacros.h
> index 14c85ef..aa8bd56 100644
> --- a/src/acpica/source/include/acmacros.h
> +++ b/src/acpica/source/include/acmacros.h
> @@ -117,8 +117,6 @@
> #define __ACMACROS_H__
>
>
> -#pragma pack(push) /* Set default struct packing */
> -
> /*
> * Extract data using a pointer. Any more than a byte and we
> * get into potential aligment issues -- see the STORE macros below.
> @@ -507,6 +505,4 @@
> #define ACPI_IS_OCTAL_DIGIT(d) (((char)(d) >= '0') && ((char)(d) <= '7'))
>
>
> -#pragma pack(pop) /* Restore original struct packing */
> -
> #endif /* ACMACROS_H */
> diff --git a/src/acpica/source/include/acnamesp.h b/src/acpica/source/include/acnamesp.h
> index 2a31cdd..883e9c4 100644
> --- a/src/acpica/source/include/acnamesp.h
> +++ b/src/acpica/source/include/acnamesp.h
> @@ -117,8 +117,6 @@
> #define __ACNAMESP_H__
>
>
> -#pragma pack(push) /* Set default struct packing */
> -
> /* To search the entire name space, pass this as SearchBase */
>
> #define ACPI_NS_ALL ((ACPI_HANDLE)0)
> @@ -609,6 +607,4 @@ void
> AcpiNsTerminate (
> void);
>
> -#pragma pack(pop) /* Restore original struct packing */
> -
> #endif /* __ACNAMESP_H__ */
> diff --git a/src/acpica/source/include/acobject.h b/src/acpica/source/include/acobject.h
> index d890f96..e90af0b 100644
> --- a/src/acpica/source/include/acobject.h
> +++ b/src/acpica/source/include/acobject.h
> @@ -116,8 +116,6 @@
> #ifndef _ACOBJECT_H
> #define _ACOBJECT_H
>
> -#pragma pack(push) /* Set default struct packing */
> -
> /* acpisrc:StructDefs -- for acpisrc conversion */
>
>
> @@ -306,7 +304,8 @@ typedef struct acpi_object_method
> #define ACPI_METHOD_INTERNAL_ONLY 0x02 /* Method is implemented internally (_OSI) */
> #define ACPI_METHOD_SERIALIZED 0x04 /* Method is serialized */
> #define ACPI_METHOD_SERIALIZED_PENDING 0x08 /* Method is to be marked serialized */
> -#define ACPI_METHOD_MODIFIED_NAMESPACE 0x10 /* Method modified the namespace */
> +#define ACPI_METHOD_IGNORE_SYNC_LEVEL 0x10 /* Method was auto-serialized at table load time */
> +#define ACPI_METHOD_MODIFIED_NAMESPACE 0x20 /* Method modified the namespace */
>
>
> /******************************************************************************
> @@ -655,6 +654,6 @@ typedef union acpi_descriptor
>
> } ACPI_DESCRIPTOR;
>
> -#pragma pack(pop) /* Restore original struct packing */
> +#pragma pack()
>
> #endif /* _ACOBJECT_H */
> diff --git a/src/acpica/source/include/acoutput.h b/src/acpica/source/include/acoutput.h
> index 4875a5f..2311c44 100644
> --- a/src/acpica/source/include/acoutput.h
> +++ b/src/acpica/source/include/acoutput.h
> @@ -116,8 +116,6 @@
> #ifndef __ACOUTPUT_H__
> #define __ACOUTPUT_H__
>
> -#pragma pack(push) /* Set default struct packing */
> -
> /*
> * Debug levels and component IDs. These are used to control the
> * granularity of the output of the ACPI_DEBUG_PRINT macro -- on a
> @@ -538,6 +536,4 @@
> #endif /* ACPI_DEBUG_OUTPUT */
>
>
> -#pragma pack(pop) /* Restore original struct packing */
> -
> #endif /* __ACOUTPUT_H__ */
> diff --git a/src/acpica/source/include/acparser.h b/src/acpica/source/include/acparser.h
> index 90df9c1..5827a8c 100644
> --- a/src/acpica/source/include/acparser.h
> +++ b/src/acpica/source/include/acparser.h
> @@ -118,8 +118,6 @@
> #define __ACPARSER_H__
>
>
> -#pragma pack(push) /* Set default struct packing */
> -
> #define OP_HAS_RETURN_VALUE 1
>
> /* Variable number of arguments. This field must be 32 bits */
> @@ -427,6 +425,4 @@ AcpiPsShow (
> ACPI_PARSE_OBJECT *op);
>
>
> -#pragma pack(pop) /* Restore original struct packing */
> -
> #endif /* __ACPARSER_H__ */
> diff --git a/src/acpica/source/include/acpiosxf.h b/src/acpica/source/include/acpiosxf.h
> index 43e99ee..00922c7 100644
> --- a/src/acpica/source/include/acpiosxf.h
> +++ b/src/acpica/source/include/acpiosxf.h
> @@ -122,8 +122,6 @@
> #include "actypes.h"
>
>
> -#pragma pack(push) /* Set default struct packing */
> -
> /* Types for AcpiOsExecute */
>
> typedef enum
> @@ -625,6 +623,4 @@ AcpiOsCloseDirectory (
> #endif
>
>
> -#pragma pack(pop) /* Restore original struct packing */
> -
> #endif /* __ACPIOSXF_H__ */
> diff --git a/src/acpica/source/include/acpixf.h b/src/acpica/source/include/acpixf.h
> index a6d7c35..61125f1 100644
> --- a/src/acpica/source/include/acpixf.h
> +++ b/src/acpica/source/include/acpixf.h
> @@ -119,15 +119,13 @@
>
> /* Current ACPICA subsystem version in YYYYMMDD format */
>
> -#define ACPI_CA_VERSION 0x20140214
> +#define ACPI_CA_VERSION 0x20140325
>
> #include "acconfig.h"
> #include "actypes.h"
> #include "actbl.h"
> #include "acbuffer.h"
>
> -#pragma pack(push) /* Set default struct packing */
> -
> /*
> * Globals that are publically available
> */
> @@ -148,7 +146,7 @@ extern UINT8 AcpiGbl_AutoSerializeMethods;
> extern UINT8 AcpiGbl_CopyDsdtLocally;
> extern UINT8 AcpiGbl_CreateOsiMethod;
> extern UINT8 AcpiGbl_DisableAutoRepair;
> -extern UINT8 AcpiGbl_DisableSsdtTableLoad;
> +extern UINT8 AcpiGbl_DisableSsdtTableInstall;
> extern UINT8 AcpiGbl_DoNotUseXsdt;
> extern UINT8 AcpiGbl_EnableAmlDebugObject;
> extern UINT8 AcpiGbl_EnableInterpreterSlack;
> @@ -276,6 +274,11 @@ AcpiDecodePldBuffer (
> * ACPI table load/unload interfaces
> */
> ACPI_STATUS
> +AcpiInstallTable (
> + ACPI_PHYSICAL_ADDRESS Address,
> + BOOLEAN Physical);
> +
> +ACPI_STATUS
> AcpiLoadTable (
> ACPI_TABLE_HEADER *Table);
>
> @@ -905,6 +908,4 @@ AcpiDebugPrintRaw (
> ...);
> #endif
>
> -#pragma pack(pop) /* Restore original struct packing */
> -
> #endif /* __ACXFACE_H__ */
> diff --git a/src/acpica/source/include/acpredef.h b/src/acpica/source/include/acpredef.h
> index 75aed15..7e804f3 100644
> --- a/src/acpica/source/include/acpredef.h
> +++ b/src/acpica/source/include/acpredef.h
> @@ -117,8 +117,6 @@
> #define __ACPREDEF_H__
>
>
> -#pragma pack(push) /* Set default struct packing */
> -
> /******************************************************************************
> *
> * Return Package types
> @@ -1141,6 +1139,4 @@ static const ACPI_PREDEFINED_INFO AcpiGbl_ScopeNames[] = {
> extern const ACPI_PREDEFINED_INFO AcpiGbl_ResourceNames[];
> #endif
>
> -#pragma pack(pop) /* Restore original struct packing */
> -
> #endif
> diff --git a/src/acpica/source/include/acresrc.h b/src/acpica/source/include/acresrc.h
> index db23891..d1366f0 100644
> --- a/src/acpica/source/include/acresrc.h
> +++ b/src/acpica/source/include/acresrc.h
> @@ -122,8 +122,6 @@
> #include "amlresrc.h"
>
>
> -#pragma pack(push) /* Set default struct packing */
> -
> /*
> * If possible, pack the following structures to byte alignment, since we
> * don't care about performance for debug output. Two cases where we cannot
> @@ -512,6 +510,4 @@ extern ACPI_RSDUMP_INFO AcpiRsDumpUartSerialBus[];
> extern ACPI_RSDUMP_INFO AcpiRsDumpGeneralFlags[];
> #endif
>
> -#pragma pack(pop) /* Restore original struct packing */
> -
> #endif /* __ACRESRC_H__ */
> diff --git a/src/acpica/source/include/acrestyp.h b/src/acpica/source/include/acrestyp.h
> index 9ff05217..9cf948b 100644
> --- a/src/acpica/source/include/acrestyp.h
> +++ b/src/acpica/source/include/acrestyp.h
> @@ -117,8 +117,6 @@
> #define __ACRESTYP_H__
>
>
> -#pragma pack(push) /* Set default struct packing */
> -
> /*
> * Definitions for Resource Attributes
> */
> @@ -771,6 +769,4 @@ typedef struct acpi_pci_routing_table
>
> } ACPI_PCI_ROUTING_TABLE;
>
> -#pragma pack(pop) /* Restore original struct packing */
> -
> #endif /* __ACRESTYP_H__ */
> diff --git a/src/acpica/source/include/acstruct.h b/src/acpica/source/include/acstruct.h
> index 7e91384..fd8eab0 100644
> --- a/src/acpica/source/include/acstruct.h
> +++ b/src/acpica/source/include/acstruct.h
> @@ -116,9 +116,6 @@
> #ifndef __ACSTRUCT_H__
> #define __ACSTRUCT_H__
>
> -
> -#pragma pack(push) /* Set default struct packing */
> -
> /* acpisrc:StructDefs -- for acpisrc conversion */
>
> /*****************************************************************************
> @@ -345,6 +342,4 @@ typedef struct acpi_walk_info
> #define ACPI_DISPLAY_SHORT (UINT8) 2
>
>
> -#pragma pack(pop) /* Restore original struct packing */
> -
> #endif
> diff --git a/src/acpica/source/include/actables.h b/src/acpica/source/include/actables.h
> index 8ec349c..3bcfd94 100644
> --- a/src/acpica/source/include/actables.h
> +++ b/src/acpica/source/include/actables.h
> @@ -117,8 +117,6 @@
> #define __ACTABLES_H__
>
>
> -#pragma pack(push) /* Set default struct packing */
> -
> ACPI_STATUS
> AcpiAllocateRootTable (
> UINT32 InitialTableCount);
> @@ -137,6 +135,40 @@ AcpiTbScanMemoryForRsdp (
>
>
> /*
> + * tbdata - table data structure management
> + */
> +ACPI_STATUS
> +AcpiTbGetNextRootIndex (
> + UINT32 *TableIndex);
> +
> +void
> +AcpiTbInitTableDescriptor (
> + ACPI_TABLE_DESC *TableDesc,
> + ACPI_PHYSICAL_ADDRESS Address,
> + UINT8 Flags,
> + ACPI_TABLE_HEADER *Table);
> +
> +ACPI_STATUS
> +AcpiTbAcquireTempTable (
> + ACPI_TABLE_DESC *TableDesc,
> + ACPI_PHYSICAL_ADDRESS Address,
> + UINT8 Flags);
> +
> +void
> +AcpiTbReleaseTempTable (
> + ACPI_TABLE_DESC *TableDesc);
> +
> +BOOLEAN
> +AcpiTbIsTableLoaded (
> + UINT32 TableIndex);
> +
> +void
> +AcpiTbSetTableLoadedFlag (
> + UINT32 TableIndex,
> + BOOLEAN IsLoaded);
> +
> +
> +/*
> * tbfadt - FADT parse/convert/validate
> */
> void
> @@ -168,17 +200,41 @@ AcpiTbResizeRootTableList (
> void);
>
> ACPI_STATUS
> -AcpiTbVerifyTable (
> +AcpiTbValidateTable (
> ACPI_TABLE_DESC *TableDesc);
>
> -ACPI_TABLE_HEADER *
> -AcpiTbTableOverride (
> - ACPI_TABLE_HEADER *TableHeader,
> +void
> +AcpiTbInvalidateTable (
> ACPI_TABLE_DESC *TableDesc);
>
> ACPI_STATUS
> -AcpiTbAddTable (
> +AcpiTbVerifyTable (
> + ACPI_TABLE_DESC *TableDesc,
> + char *Signature);
> +
> +void
> +AcpiTbOverrideTable (
> + ACPI_TABLE_DESC *OldTableDesc);
> +
> +ACPI_STATUS
> +AcpiTbAcquireTable (
> ACPI_TABLE_DESC *TableDesc,
> + ACPI_TABLE_HEADER **TablePtr,
> + UINT32 *TableLength,
> + UINT8 *TableFlags);
> +
> +void
> +AcpiTbReleaseTable (
> + ACPI_TABLE_HEADER *Table,
> + UINT32 TableLength,
> + UINT8 TableFlags);
> +
> +ACPI_STATUS
> +AcpiTbInstallStandardTable (
> + ACPI_PHYSICAL_ADDRESS Address,
> + UINT8 Flags,
> + BOOLEAN Reload,
> + BOOLEAN Override,
> UINT32 *TableIndex);
>
> ACPI_STATUS
> @@ -190,7 +246,7 @@ AcpiTbStoreTable (
> UINT32 *TableIndex);
>
> void
> -AcpiTbDeleteTable (
> +AcpiTbUninstallTable (
> ACPI_TABLE_DESC *TableDesc);
>
> void
> @@ -214,15 +270,6 @@ AcpiTbGetOwnerId (
> UINT32 TableIndex,
> ACPI_OWNER_ID *OwnerId);
>
> -BOOLEAN
> -AcpiTbIsTableLoaded (
> - UINT32 TableIndex);
> -
> -void
> -AcpiTbSetTableLoadedFlag (
> - UINT32 TableIndex,
> - BOOLEAN IsLoaded);
> -
>
> /*
> * tbutils - table manager utilities
> @@ -259,7 +306,13 @@ AcpiTbCopyDsdt (
> UINT32 TableIndex);
>
> void
> -AcpiTbInstallTable (
> +AcpiTbInstallTableWithOverride (
> + UINT32 TableIndex,
> + ACPI_TABLE_DESC *NewTableDesc,
> + BOOLEAN Override);
> +
> +ACPI_STATUS
> +AcpiTbInstallFixedTable (
> ACPI_PHYSICAL_ADDRESS Address,
> char *Signature,
> UINT32 TableIndex);
> @@ -268,6 +321,4 @@ ACPI_STATUS
> AcpiTbParseRootTable (
> ACPI_PHYSICAL_ADDRESS RsdpAddress);
>
> -#pragma pack(pop) /* Restore original struct packing */
> -
> #endif /* __ACTABLES_H__ */
> diff --git a/src/acpica/source/include/actbl.h b/src/acpica/source/include/actbl.h
> index 37d44d7..9a6625c 100644
> --- a/src/acpica/source/include/actbl.h
> +++ b/src/acpica/source/include/actbl.h
> @@ -117,8 +117,6 @@
> #define __ACTBL_H__
>
>
> -#pragma pack(push) /* Set default struct packing */
> -
> /*******************************************************************************
> *
> * Fundamental ACPI tables
> @@ -476,12 +474,11 @@ typedef struct acpi_table_desc
>
> /* Masks for Flags field above */
>
> -#define ACPI_TABLE_ORIGIN_UNKNOWN (0)
> -#define ACPI_TABLE_ORIGIN_MAPPED (1)
> -#define ACPI_TABLE_ORIGIN_ALLOCATED (2)
> -#define ACPI_TABLE_ORIGIN_OVERRIDE (4)
> -#define ACPI_TABLE_ORIGIN_MASK (7)
> -#define ACPI_TABLE_IS_LOADED (8)
> +#define ACPI_TABLE_ORIGIN_EXTERNAL_VIRTUAL (0) /* Virtual address, external maintained */
> +#define ACPI_TABLE_ORIGIN_INTERNAL_PHYSICAL (1) /* Physical address, internally mapped */
> +#define ACPI_TABLE_ORIGIN_INTERNAL_VIRTUAL (2) /* Virtual address, internallly allocated */
> +#define ACPI_TABLE_ORIGIN_MASK (3)
> +#define ACPI_TABLE_IS_LOADED (8)
>
>
> /*
> @@ -514,6 +511,4 @@ typedef struct acpi_table_desc
> #define ACPI_FADT_V3_SIZE (UINT32) (ACPI_FADT_OFFSET (SleepControl))
> #define ACPI_FADT_V5_SIZE (UINT32) (sizeof (ACPI_TABLE_FADT))
>
> -#pragma pack(pop) /* Restore original struct packing */
> -
> #endif /* __ACTBL_H__ */
> diff --git a/src/acpica/source/include/actbl1.h b/src/acpica/source/include/actbl1.h
> index 24a51a3..4710672 100644
> --- a/src/acpica/source/include/actbl1.h
> +++ b/src/acpica/source/include/actbl1.h
> @@ -117,8 +117,6 @@
> #define __ACTBL1_H__
>
>
> -#pragma pack(push) /* Set default struct packing */
> -
> /*******************************************************************************
> *
> * Additional ACPI Tables (1)
> @@ -1215,6 +1213,8 @@ typedef struct acpi_srat_x2apic_cpu_affinity
> #define ACPI_SRAT_CPU_ENABLED (1) /* 00: Use affinity structure */
>
>
> -#pragma pack(pop) /* Restore original struct packing */
> +/* Reset to default packing */
> +
> +#pragma pack()
>
> #endif /* __ACTBL1_H__ */
> diff --git a/src/acpica/source/include/actbl2.h b/src/acpica/source/include/actbl2.h
> index 5123a93..2ae8ce3 100644
> --- a/src/acpica/source/include/actbl2.h
> +++ b/src/acpica/source/include/actbl2.h
> @@ -117,8 +117,6 @@
> #define __ACTBL2_H__
>
>
> -#pragma pack(push) /* Set default struct packing */
> -
> /*******************************************************************************
> *
> * Additional ACPI Tables (2)
> @@ -1490,6 +1488,8 @@ typedef struct acpi_table_wdrt
> } ACPI_TABLE_WDRT;
>
>
> -#pragma pack(pop) /* Restore original struct packing */
> +/* Reset to default packing */
> +
> +#pragma pack()
>
> #endif /* __ACTBL2_H__ */
> diff --git a/src/acpica/source/include/actbl3.h b/src/acpica/source/include/actbl3.h
> index 5ab1ff5..efec7e8 100644
> --- a/src/acpica/source/include/actbl3.h
> +++ b/src/acpica/source/include/actbl3.h
> @@ -117,8 +117,6 @@
> #define __ACTBL3_H__
>
>
> -#pragma pack(push) /* Set default struct packing */
> -
> /*******************************************************************************
> *
> * Additional ACPI Tables (3)
> @@ -806,6 +804,8 @@ typedef struct acpi_tpm2_control
> } ACPI_TPM2_CONTROL;
>
>
> -#pragma pack(pop) /* Restore original struct packing */
> +/* Reset to default packing */
> +
> +#pragma pack()
>
> #endif /* __ACTBL3_H__ */
> diff --git a/src/acpica/source/include/actypes.h b/src/acpica/source/include/actypes.h
> index b2dc8a7..a02cd10 100644
> --- a/src/acpica/source/include/actypes.h
> +++ b/src/acpica/source/include/actypes.h
> @@ -116,8 +116,6 @@
> #ifndef __ACTYPES_H__
> #define __ACTYPES_H__
>
> -#pragma pack(push) /* Set default struct packing */
> -
> /* acpisrc:StructDefs -- for acpisrc conversion */
>
> /*
> @@ -1389,6 +1387,4 @@ typedef struct acpi_memory_list
> #define ACPI_OSI_WIN_8 0x0C
>
>
> -#pragma pack(pop) /* Restore original struct packing */
> -
> #endif /* __ACTYPES_H__ */
> diff --git a/src/acpica/source/include/acutils.h b/src/acpica/source/include/acutils.h
> index 1bf4319..b1c512b 100644
> --- a/src/acpica/source/include/acutils.h
> +++ b/src/acpica/source/include/acutils.h
> @@ -117,8 +117,6 @@
> #define _ACUTILS_H
>
>
> -#pragma pack(push) /* Set default struct packing */
> -
> extern const UINT8 AcpiGbl_ResourceAmlSizes[];
> extern const UINT8 AcpiGbl_ResourceAmlSerialBusSizes[];
>
> @@ -263,8 +261,8 @@ AcpiUtGetMutexName (
>
> const char *
> AcpiUtGetNotifyName (
> - UINT32 NotifyValue);
> -
> + UINT32 NotifyValue,
> + ACPI_OBJECT_TYPE Type);
> #endif
>
> char *
> @@ -1173,7 +1171,15 @@ AcpiUtMethodError (
> const char *Path,
> ACPI_STATUS LookupStatus);
>
> +/*
> + * Utility functions for ACPI names and IDs
> + */
> +const AH_PREDEFINED_NAME *
> +AcpiAhMatchPredefinedName (
> + char *Nameseg);
>
> -#pragma pack(pop) /* Restore original struct packing */
> +const AH_DEVICE_ID *
> +AcpiAhMatchHardwareId (
> + char *Hid);
>
> #endif /* _ACUTILS_H */
> diff --git a/src/acpica/source/include/amlcode.h b/src/acpica/source/include/amlcode.h
> index 8cf250c..5eaf30c 100644
> --- a/src/acpica/source/include/amlcode.h
> +++ b/src/acpica/source/include/amlcode.h
> @@ -118,9 +118,6 @@
> #ifndef __AMLCODE_H__
> #define __AMLCODE_H__
>
> -#pragma pack(push) /* Set default struct packing */
> -
> -
> /* primary opcodes */
>
> #define AML_NULL_CHAR (UINT16) 0x00
> @@ -584,6 +581,4 @@ typedef enum
> #define AML_METHOD_SYNC_LEVEL 0xF0
>
>
> -#pragma pack(pop) /* Restore original struct packing */
> -
> #endif /* __AMLCODE_H__ */
> diff --git a/src/acpica/source/include/amlresrc.h b/src/acpica/source/include/amlresrc.h
> index c54ae1f..3fcd9ed 100644
> --- a/src/acpica/source/include/amlresrc.h
> +++ b/src/acpica/source/include/amlresrc.h
> @@ -119,8 +119,6 @@
> #define __AMLRESRC_H
>
>
> -#pragma pack(push) /* Set default struct packing */
> -
> /*
> * Resource descriptor tags, as defined in the ACPI specification.
> * Used to symbolically reference fields within a descriptor.
> @@ -648,7 +646,4 @@ typedef union aml_resource
>
> } AML_RESOURCE;
>
> -
> -#pragma pack(pop) /* Restore original struct packing */
> -
> #endif
> diff --git a/src/acpica/source/include/platform/acgcc.h b/src/acpica/source/include/platform/acgcc.h
> index dd56819..9cb3cbe 100644
> --- a/src/acpica/source/include/platform/acgcc.h
> +++ b/src/acpica/source/include/platform/acgcc.h
> @@ -136,4 +136,15 @@
> */
> #define ACPI_UNUSED_VAR __attribute__ ((unused))
>
> +/*
> + * Some versions of gcc implement strchr() with a buggy macro. So,
> + * undef it here. Prevents error messages of this form (usually from the
> + * file getopt.c):
> + *
> + * error: logical '&&' with non-zero constant will always evaluate as true
> + */
> +#ifdef strchr
> +#undef strchr
> +#endif
> +
> #endif /* __ACGCC_H__ */
> diff --git a/src/acpica/source/include/platform/aclinux.h b/src/acpica/source/include/platform/aclinux.h
> index e85cc79..c7ca287 100644
> --- a/src/acpica/source/include/platform/aclinux.h
> +++ b/src/acpica/source/include/platform/aclinux.h
> @@ -156,12 +156,23 @@
> #include <ctype.h>
> #include <unistd.h>
>
> +/* Define/disable kernel-specific declarators */
> +
> +#ifndef __init
> +#define __init
> +#endif
> +
> +#ifndef __iomem
> +#define __iomem
> +#endif
> +
> /* Host-dependent types and defines for user-space ACPICA */
>
> #define ACPI_FLUSH_CPU_CACHE()
> #define ACPI_CAST_PTHREAD_T(Pthread) ((ACPI_THREAD_ID) (Pthread))
>
> -#if defined(__ia64__) || defined(__x86_64__) || defined(__aarch64__) || defined(__PPC64__)
> +#if defined(__ia64__) || defined(__x86_64__) ||\
> + defined(__aarch64__) || defined(__PPC64__)
> #define ACPI_MACHINE_WIDTH 64
> #define COMPILER_DEPENDENT_INT64 long
> #define COMPILER_DEPENDENT_UINT64 unsigned long
> diff --git a/src/acpica/source/os_specific/service_layers/osunixxf.c b/src/acpica/source/os_specific/service_layers/osunixxf.c
> index f0f645a..6c1f5e6 100644
> --- a/src/acpica/source/os_specific/service_layers/osunixxf.c
> +++ b/src/acpica/source/os_specific/service_layers/osunixxf.c
> @@ -1417,7 +1417,7 @@ AcpiOsWritable (
> *
> * FUNCTION: AcpiOsSignal
> *
> - * PARAMETERS: Function - ACPI CA signal function code
> + * PARAMETERS: Function - ACPI A signal function code
> * Info - Pointer to function-dependent structure
> *
> * RETURN: Status
> diff --git a/src/acpica/source/tools/acpiexec/aecommon.h b/src/acpica/source/tools/acpiexec/aecommon.h
> index 599abbc..5aac8f8 100644
> --- a/src/acpica/source/tools/acpiexec/aecommon.h
> +++ b/src/acpica/source/tools/acpiexec/aecommon.h
> @@ -135,8 +135,6 @@
> #include <string.h>
> #include <signal.h>
>
> -#pragma pack(push) /* Set default struct packing */
> -
> extern BOOLEAN AcpiGbl_IgnoreErrors;
> extern UINT8 AcpiGbl_RegionFillValue;
> extern UINT8 AcpiGbl_UseHwReducedFadt;
> @@ -270,7 +268,4 @@ AeGlobalEventHandler (
> UINT32 EventNumber,
> void *Context);
>
> -
> -#pragma pack(pop) /* Restore original struct packing */
> -
> #endif /* _AECOMMON */
> diff --git a/src/acpica/source/tools/acpiexec/aehandlers.c b/src/acpica/source/tools/acpiexec/aehandlers.c
> index 5a29a58..79fe358 100644
> --- a/src/acpica/source/tools/acpiexec/aehandlers.c
> +++ b/src/acpica/source/tools/acpiexec/aehandlers.c
> @@ -384,7 +384,7 @@ AeCommonNotifyHandler (
>
> printf ("[AcpiExec] Handler %u: Received a %s Notify on [%4.4s] %p Value 0x%2.2X (%s)\n",
> HandlerId, Type, AcpiUtGetNodeName (Device), Device, Value,
> - AcpiUtGetNotifyName (Value));
> + AcpiUtGetNotifyName (Value, ACPI_TYPE_ANY));
> if (AcpiGbl_DebugFile)
> {
> AcpiOsPrintf ("[AcpiExec] Handler %u: Received a %s notify, Value 0x%2.2X\n",
> @@ -420,7 +420,7 @@ AeSystemNotifyHandler (
>
> printf ("[AcpiExec] Global: Received a System Notify on [%4.4s] %p Value 0x%2.2X (%s)\n",
> AcpiUtGetNodeName (Device), Device, Value,
> - AcpiUtGetNotifyName (Value));
> + AcpiUtGetNotifyName (Value, ACPI_TYPE_ANY));
> if (AcpiGbl_DebugFile)
> {
> AcpiOsPrintf ("[AcpiExec] Global: Received a System Notify, Value 0x%2.2X\n", Value);
> @@ -453,7 +453,7 @@ AeDeviceNotifyHandler (
>
> printf ("[AcpiExec] Global: Received a Device Notify on [%4.4s] %p Value 0x%2.2X (%s)\n",
> AcpiUtGetNodeName (Device), Device, Value,
> - AcpiUtGetNotifyName (Value));
> + AcpiUtGetNotifyName (Value, ACPI_TYPE_ANY));
> if (AcpiGbl_DebugFile)
> {
> AcpiOsPrintf ("[AcpiExec] Global: Received a Device Notify, Value 0x%2.2X\n", Value);
>
Acked-by: Ivan Hu <ivan.hu at canonical.com>
More information about the fwts-devel
mailing list