[BACK]Return to tbprint.c CVS log [TXT][DIR] Up to [cvs.NetBSD.org] / src / sys / external / bsd / acpica / dist / tables

File: [cvs.NetBSD.org] / src / sys / external / bsd / acpica / dist / tables / tbprint.c (download)

Revision 1.1.1.8 (vendor branch), Sat Apr 7 14:12:48 2018 UTC (6 years ago) by christos
Branch: intel, MAIN
CVS Tags: phil-wifi-base, pgoyette-compat-20190127, pgoyette-compat-20190118, pgoyette-compat-1226, pgoyette-compat-1126, pgoyette-compat-1020, pgoyette-compat-0930, pgoyette-compat-0906, pgoyette-compat-0728, pgoyette-compat-0625, pgoyette-compat-0521, pgoyette-compat-0502, pgoyette-compat-0422, pgoyette-compat-0415, isaki-audio2-base, isaki-audio2, acpica-20181213, acpica-20180810, acpica-20180427, acpica-20180313
Branch point for: phil-wifi
Changes since 1.1.1.7: +1 -1 lines


----------------------------------------
13 March 2018. Summary of changes for version 20180313:


1) ACPICA kernel-resident subsystem:

Implemented various improvements to the GPE support:

1) Dispatch all active GPEs at initialization time so that no GPEs are
lost.
2) Enable runtime GPEs earlier. Some systems expect GPEs to be enabled
before devices are enumerated.
3) Don't unconditionally clear ACPI IRQs during suspend/resume, so that
IRQs are not lost.
4) Add parallel GPE handling to eliminate the possibility of dispatching
the same GPE twice.
5) Dispatch any pending GPEs after enabling for the first time.

AcpiGetObjectInfo - removed support for the _STA method. This was causing
problems on some platforms.

Added a new _OSI string, "Windows 2017.2".

Cleaned up and simplified the module-level code support. These changes
are in preparation for the eventual removal of the legacy MLC support
(deferred execution), replaced by the new MLC architecture which executes
the MLC as a table is loaded (DSDT/SSDTs).

Changed a compile-time option to a runtime option. Changes the option to
ignore ACPI table load-time package resolution errors into a runtime
option. Used only for platforms that generate many AE_NOT_FOUND errors
during boot. AcpiGbl_IgnorePackageResolutionErrors.

Fixed the ACPI_ERROR_NAMESPACE macro. This change involves putting some
ACPI_ERROR_NAMESPACE parameters inside macros. By doing so, we avoid
compilation errors from unused variables (seen with some compilers).


2) iASL Compiler/Disassembler and Tools:

ASLTS: parallelized execution in order to achieve an (approximately) 2X
performance increase.

ASLTS: Updated to use the iASL __LINE__ and __METHOD__ macros. Improves
error reporting.

----------------------------------------
09 February 2018. Summary of changes for version 20180209:


1) ACPICA kernel-resident subsystem:

Completed the final integration of the recent changes to Package Object
handling and the module-level AML code support. This allows forward
references from individual package elements when the package object is
declared from within module-level code blocks. Provides compatibility
with other ACPI implementations.

The new architecture for the AML module-level code has been completed and
is now the default for the ACPICA code. This new architecture executes
the module-level code in-line as the ACPI table is loaded/parsed instead
of the previous architecture which deferred this code until after the
table was fully loaded. This solves some ASL code ordering issues and
provides compatibility with other ACPI implementations. At this time,
there is an option to fallback to the earlier architecture, but this
support is deprecated and is planned to be completely removed later this
year.

Added a compile-time option to ignore AE_NOT_FOUND exceptions during
resolution of named reference elements within Package objects. Although
this is potentially a serious problem, it can generate a lot of
noise/errors on platforms whose firmware carries around a bunch of unused
Package objects. To disable these errors, define
ACPI_IGNORE_PACKAGE_RESOLUTION_ERRORS in the OS-specific header. All
errors are always reported for ACPICA applications such as AcpiExec.

Fixed a regression related to the explicit type-conversion AML operators
(ToXXXX). The regression was introduced early in 2017 but was not seen
until recently because these operators are not fully supported by other
ACPI implementations and are thus rarely used by firmware developers. The
operators are defined by the ACPI specification to not implement the
"implicit result object conversion". The regression incorrectly
introduced this object conversion for the following explicit conversion
operators:
    ToInteger
    ToString
    ToBuffer
    ToDecimalString
    ToHexString
    ToBCD
    FromBCD


2) iASL Compiler/Disassembler and Tools:

iASL: Fixed a problem with the compiler constant folding feature as
related to the ToXXXX explicit conversion operators. These operators do
not support the "implicit result object conversion" by definition. Thus,
ASL expressions that use these operators cannot be folded to a simple
Store operator because Store implements the implicit conversion. This
change uses the CopyObject operator for the ToXXXX operator folding
instead. CopyObject is defined to not implement implicit result
conversions and is thus appropriate for folding the ToXXXX operators.

iASL: Changed the severity of an error condition to a simple warning for
the case where a symbol is declared both locally and as an external
symbol. This accommodates existing ASL code.

AcpiExec: The -ep option to enable the new architecture for module-level
code has been removed. It is replaced by the -dp option which instead has
the opposite effect: it disables the new architecture (the default) and
enables the legacy architecture. When the legacy code is removed in the
future, the -dp option will be removed also.

----------------------------------------
05 January 2018. Summary of changes for version 20180105:


1) ACPICA kernel-resident subsystem:

Updated all copyrights to 2018. This affects all source code modules.

Fixed a possible build error caused by an unresolved reference to the
AcpiUtSafeStrncpy function.

Removed NULL pointer arithmetic in the various pointer manipulation
macros. All "(void *) NULL" constructs are converted to "(void *) 0".
This eliminates warnings/errors in newer C compilers. Jung-uk Kim.

Added support for A32 ABI compilation, which uses the ILP32 model. Anuj
Mittal.


2) iASL Compiler/Disassembler and Tools:

ASLTS: Updated all copyrights to 2018.

Tools: Updated all signon copyrights to 2018.

AcpiXtract: Fixed a regression related to ACPI table signatures where the
signature was truncated to 3 characters (instead of 4).

AcpiExec: Restore the original terminal mode after the use of the -v and
-vd options.

ASLTS: Deployed the iASL __METHOD__ macro across the test suite.

----------------------------------------
14 December 2017. Summary of changes for version 20171214:


1) ACPICA kernel-resident subsystem:

Fixed a regression in the external (public) AcpiEvaluateObjectTyped
interface where the optional "pathname" argument had inadvertently become
a required argument returning an error if omitted (NULL pointer
argument).

Fixed two possible memory leaks related to the recently developed "late
resolution" of reference objects within ASL Package Object definitions.

Added two recently defined _OSI strings: "Windows 2016" and "Windows
2017". Mario Limonciello.

Implemented and deployed a safer version of the C library function
strncpy:  AcpiUtSafeStrncpy. The intent is to at least prevent the
creation of unterminated strings as a possible result of a standard
strncpy.

Cleaned up and restructured the global variable file (acglobal.h). There
are many changes, but no functional changes.


2) iASL Compiler/Disassembler and Tools:

iASL Table Compiler: Fixed a problem with the DBG2 ACPI table where the
optional OemData field at the end of the table was incorrectly required
for proper compilation. It is now correctly an optional field.

ASLTS: The entire suite was converted from standard ASL to the ASL+
language, using the ASL-to-ASL+ converter which is integrated into the
iASL compiler. A binary compare of all output files has verified the
correctness of the conversion.

iASL: Fixed the source code build for platforms where "char" is unsigned.
This affected the iASL lexer only. Jung-uk Kim.

/******************************************************************************
 *
 * Module Name: tbprint - Table output utilities
 *
 *****************************************************************************/

/*
 * Copyright (C) 2000 - 2018, Intel Corp.
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions, and the following disclaimer,
 *    without modification.
 * 2. Redistributions in binary form must reproduce at minimum a disclaimer
 *    substantially similar to the "NO WARRANTY" disclaimer below
 *    ("Disclaimer") and any redistribution must be conditioned upon
 *    including a substantially similar Disclaimer requirement for further
 *    binary redistribution.
 * 3. Neither the names of the above-listed copyright holders nor the names
 *    of any contributors may be used to endorse or promote products derived
 *    from this software without specific prior written permission.
 *
 * Alternatively, this software may be distributed under the terms of the
 * GNU General Public License ("GPL") version 2 as published by the Free
 * Software Foundation.
 *
 * NO WARRANTY
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
 * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 * POSSIBILITY OF SUCH DAMAGES.
 */

#include "acpi.h"
#include "accommon.h"
#include "actables.h"

#define _COMPONENT          ACPI_TABLES
        ACPI_MODULE_NAME    ("tbprint")


/* Local prototypes */

static void
AcpiTbFixString (
    char                    *String,
    ACPI_SIZE               Length);

static void
AcpiTbCleanupTableHeader (
    ACPI_TABLE_HEADER       *OutHeader,
    ACPI_TABLE_HEADER       *Header);


/*******************************************************************************
 *
 * FUNCTION:    AcpiTbFixString
 *
 * PARAMETERS:  String              - String to be repaired
 *              Length              - Maximum length
 *
 * RETURN:      None
 *
 * DESCRIPTION: Replace every non-printable or non-ascii byte in the string
 *              with a question mark '?'.
 *
 ******************************************************************************/

static void
AcpiTbFixString (
    char                    *String,
    ACPI_SIZE               Length)
{

    while (Length && *String)
    {
        if (!isprint ((int) *String))
        {
            *String = '?';
        }

        String++;
        Length--;
    }
}


/*******************************************************************************
 *
 * FUNCTION:    AcpiTbCleanupTableHeader
 *
 * PARAMETERS:  OutHeader           - Where the cleaned header is returned
 *              Header              - Input ACPI table header
 *
 * RETURN:      Returns the cleaned header in OutHeader
 *
 * DESCRIPTION: Copy the table header and ensure that all "string" fields in
 *              the header consist of printable characters.
 *
 ******************************************************************************/

static void
AcpiTbCleanupTableHeader (
    ACPI_TABLE_HEADER       *OutHeader,
    ACPI_TABLE_HEADER       *Header)
{

    memcpy (OutHeader, Header, sizeof (ACPI_TABLE_HEADER));

    AcpiTbFixString (OutHeader->Signature, ACPI_NAME_SIZE);
    AcpiTbFixString (OutHeader->OemId, ACPI_OEM_ID_SIZE);
    AcpiTbFixString (OutHeader->OemTableId, ACPI_OEM_TABLE_ID_SIZE);
    AcpiTbFixString (OutHeader->AslCompilerId, ACPI_NAME_SIZE);
}


/*******************************************************************************
 *
 * FUNCTION:    AcpiTbPrintTableHeader
 *
 * PARAMETERS:  Address             - Table physical address
 *              Header              - Table header
 *
 * RETURN:      None
 *
 * DESCRIPTION: Print an ACPI table header. Special cases for FACS and RSDP.
 *
 ******************************************************************************/

void
AcpiTbPrintTableHeader (
    ACPI_PHYSICAL_ADDRESS   Address,
    ACPI_TABLE_HEADER       *Header)
{
    ACPI_TABLE_HEADER       LocalHeader;


    if (ACPI_COMPARE_NAME (Header->Signature, ACPI_SIG_FACS))
    {
        /* FACS only has signature and length fields */

        ACPI_INFO (("%-4.4s 0x%8.8X%8.8X %06X",
            Header->Signature, ACPI_FORMAT_UINT64 (Address),
            Header->Length));
    }
    else if (ACPI_VALIDATE_RSDP_SIG (Header->Signature))
    {
        /* RSDP has no common fields */

        memcpy (LocalHeader.OemId, ACPI_CAST_PTR (ACPI_TABLE_RSDP,
            Header)->OemId, ACPI_OEM_ID_SIZE);
        AcpiTbFixString (LocalHeader.OemId, ACPI_OEM_ID_SIZE);

        ACPI_INFO (("RSDP 0x%8.8X%8.8X %06X (v%.2d %-6.6s)",
            ACPI_FORMAT_UINT64 (Address),
            (ACPI_CAST_PTR (ACPI_TABLE_RSDP, Header)->Revision > 0) ?
                ACPI_CAST_PTR (ACPI_TABLE_RSDP, Header)->Length : 20,
            ACPI_CAST_PTR (ACPI_TABLE_RSDP, Header)->Revision,
            LocalHeader.OemId));
    }
    else
    {
        /* Standard ACPI table with full common header */

        AcpiTbCleanupTableHeader (&LocalHeader, Header);

        ACPI_INFO ((
            "%-4.4s 0x%8.8X%8.8X"
            " %06X (v%.2d %-6.6s %-8.8s %08X %-4.4s %08X)",
            LocalHeader.Signature, ACPI_FORMAT_UINT64 (Address),
            LocalHeader.Length, LocalHeader.Revision, LocalHeader.OemId,
            LocalHeader.OemTableId, LocalHeader.OemRevision,
            LocalHeader.AslCompilerId, LocalHeader.AslCompilerRevision));
    }
}


/*******************************************************************************
 *
 * FUNCTION:    AcpiTbValidateChecksum
 *
 * PARAMETERS:  Table               - ACPI table to verify
 *              Length              - Length of entire table
 *
 * RETURN:      Status
 *
 * DESCRIPTION: Verifies that the table checksums to zero. Optionally returns
 *              exception on bad checksum.
 *
 ******************************************************************************/

ACPI_STATUS
AcpiTbVerifyChecksum (
    ACPI_TABLE_HEADER       *Table,
    UINT32                  Length)
{
    UINT8                   Checksum;


    /*
     * FACS/S3PT:
     * They are the odd tables, have no standard ACPI header and no checksum
     */

    if (ACPI_COMPARE_NAME (Table->Signature, ACPI_SIG_S3PT) ||
        ACPI_COMPARE_NAME (Table->Signature, ACPI_SIG_FACS))
    {
        return (AE_OK);
    }

    /* Compute the checksum on the table */

    Checksum = AcpiTbChecksum (ACPI_CAST_PTR (UINT8, Table), Length);

    /* Checksum ok? (should be zero) */

    if (Checksum)
    {
        ACPI_BIOS_WARNING ((AE_INFO,
            "Incorrect checksum in table [%4.4s] - 0x%2.2X, "
            "should be 0x%2.2X",
            Table->Signature, Table->Checksum,
            (UINT8) (Table->Checksum - Checksum)));

#if (ACPI_CHECKSUM_ABORT)
        return (AE_BAD_CHECKSUM);
#endif
    }

    return (AE_OK);
}


/*******************************************************************************
 *
 * FUNCTION:    AcpiTbChecksum
 *
 * PARAMETERS:  Buffer          - Pointer to memory region to be checked
 *              Length          - Length of this memory region
 *
 * RETURN:      Checksum (UINT8)
 *
 * DESCRIPTION: Calculates circular checksum of memory region.
 *
 ******************************************************************************/

UINT8
AcpiTbChecksum (
    UINT8                   *Buffer,
    UINT32                  Length)
{
    UINT8                   Sum = 0;
    UINT8                   *End = Buffer + Length;


    while (Buffer < End)
    {
        Sum = (UINT8) (Sum + *(Buffer++));
    }

    return (Sum);
}