Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/external/bsd/acpica/dist/utilities Import acpica-20160930:



details:   https://anonhg.NetBSD.org/src/rev/c322ec184139
branches:  trunk
changeset: 819002:c322ec184139
user:      christos <christos%NetBSD.org@localhost>
date:      Fri Nov 11 19:24:26 2016 +0000

description:
Import acpica-20160930:

----------------------------------------
30 September 2016. Summary of changes for version 20160930:


1) ACPICA kernel-resident subsystem:

Fixed a regression in the internal AcpiTbFindTable function where a non
AE_OK exception could inadvertently be returned even if the function did
not fail. This problem affects the following operators:
    DataTableRegion
    LoadTable

Fixed a regression in the LoadTable operator where a load to any
namespace location other than the root no longer worked properly.

Increased the maximum loop count value that will result in the
AE_AML_INFINITE_LOOP exception. This is a mechanism that is intended to
prevent infinite loops within the AML interpreter and thus the host OS
kernel. The value is increased from 0xFFFF to 0xFFFFF loops (65,535 to
1,048,575).

Moved the AcpiGbl_MaxLoopIterations configuration variable to the public
acpixf.h file. This allows hosts to easily configure the maximum loop
count at runtime.

Removed an illegal character in the strtoul64.c file. This character
caused errors with some C compilers.

Example Code and Data Size: These are the sizes for the OS-independent
acpica.lib produced by the Microsoft Visual C++ 9.0 32-bit compiler. The
debug version of the code includes the debug output trace mechanism and
has a much larger code and data size.

  Current Release:
    Non-Debug Version: 140.4K Code, 58.1K Data, 198.5K Total
    Debug Version:     200.7K Code, 82.1K Data, 282.8K Total
  Previous Release:
    Non-Debug Version: 140.0K Code, 58.1K Data, 198.1K Total
    Debug Version:     200.3K Code, 82.1K Data, 282.4K Total


2) iASL Compiler/Disassembler and Tools:

Disassembler: Fixed a problem with the conversion of Else{If{ blocks into
the simpler ASL ElseIf keyword. During the conversion, a trailing If
block could be lost and missing from the disassembled output.

iASL: Fixed a missing parser rule for the ObjectType operator. For ASL+,
the missing rule caused a parse error when using the Index operator as an
operand to ObjectType. This construct now compiles properly. Example:
    ObjectType(PKG1[4]).

iASL: Correctly handle unresolved symbols in the hardware map file (-lm
option). Previously, unresolved symbols could cause a protection fault.
Such symbols are now marked as unresolved in the map file.

iASL: Implemented support to allow control method invocations as an
operand to the ASL DeRefOf operator. Example:
    DeRefOf(MTH1(Local0))

Disassembler: Improved support for the ToPLD ASL macro. Detection of a
possible _PLD buffer now includes examination of both the normal buffer
length (16 or 20) as well as the surrounding AML package length.

Disassembler: Fixed a problem with the decoding of complex expressions
within the Divide operator for ASL+. For the case where both the quotient
and remainder targets are specified, the entire statement cannot be
disassembled. Previously, the output incorrectly contained a mix of ASL-
and ASL+ operators. This mixed statement causes a syntax error when
compiled. Example:
    Divide (Add (INT1, 6), 128, RSLT, QUOT)  // was incorrectly
disassembled to:
    Divide (INT1 + 6, 128, RSLT, QUOT)

iASL/Tools: Added support to process AML and non-AML ACPI tables
consistently. For the disassembler and AcpiExec, allow all types of ACPI
tables (AML and data tables). For the iASL -e option, allow only AML
tables (DSDT/SSDT).

----------------------------------------
31 August 2016. Summary of changes for version 20160831:


1) ACPICA kernel-resident subsystem:

Improve support for the so-called "module-level code", which is defined
to be math, logical and control AML opcodes that appear outside of any
control method. This change improves the support by adding more opcodes
that can be executed in the manner. Some other issues have been solved,
and the ASL grammar changes to support such code under all scope
operators (Device, etc.) are complete. Lv Zheng.

UEFI support: these OSL functions have been implemented. This is an
additional step toward supporting the AcpiExec utility natively (with
full hardware access) under UEFI. Marcelo Ferreira.
    AcpiOsReadPciConfiguration
    AcpiOsWritePciConfiguration

Fixed a possible mutex error during control method auto-serialization. Lv
Zheng.

Updated support for the Generic Address Structure by fully implementing
all GAS fields when a 32-bit address is expanded to a 64-bit GAS. Lv
Zheng.

Updated the return value for the internal _OSI method. Instead of
0xFFFFFFFF, the "Ones" value is now returned, which is 0xFFFFFFFFFFFFFFFF
for 64-bit ACPI tables. This fixes an incompatibility with other ACPI
implementations, and will be reflected and clarified in the next version
of the ACPI specification.

Implemented two new table events that can be passed to an ACPICA table
handler. These events are used to indicate a table installation or
uninstallation. These events are used in addition to existed table load
and unload events. Lv Zheng.

Implemented a cleanup for all internal string-to-integer conversions.
Consolidate multiple versions of this functionality and limit possible
bases to either 10 or 16 to simplify the code. Adds a new file,
utstrtoul64.

Cleanup the inclusion order of the various compiler-specific headers.
This simplifies build configuration management. The compiler-specific
headers are now split out from the host-specific headers. Lv Zheng.

Example Code and Data Size: These are the sizes for the OS-independent
acpica.lib produced by the Microsoft Visual C++ 9.0 32-bit compiler. The
debug version of the code includes the debug output trace mechanism and
has a much larger code and data size.

  Current Release:
    Non-Debug Version: 140.1K Code, 58.1K Data, 198.1K Total
    Debug Version:     200.3K Code, 82.1K Data, 282.4K Total


2) iASL Compiler/Disassembler and Tools:

iASL/AcpiExec: Added a command line option to display the build date/time
of the tool (-vd). This can be useful to verify that the correct version
of the tools are being used.

AML Debugger: Implemented a new subcommand ("execute predef") to execute
all predefined control methods and names within the current namespace.
This can be useful for debugging problems with ACPI tables and the ACPI
namespace.

----------------------------------------
29 July 2016. Summary of changes for version 20160729:


1) ACPICA kernel-resident subsystem:

Implemented basic UEFI support for the various ACPICA tools. This
includes:
1) An OSL to implement the various AcpiOs* interfaces on UEFI.
2) Support to obtain the ACPI tables on UEFI.
3) Local implementation of required C library functions not available on
UEFI.
4) A front-end (main) function for the tools for UEFI-related
initialization.

The initial deployment of this support is the AcpiDump utility executing
as an UEFI application via EDK2 (EDKII, "UEFI Firmware Development Kit").
Current environments supported are Linux/Unix. MSVC generation is not
supported at this time. See the generate/efi/README file for build
instructions. Lv Zheng.

Future plans include porting the AcpiExec utility to execute natively on
the platform with I/O and memory access. This will allow viewing/dump of
the platform namespace and native execution of ACPI control methods that
access the actual hardware. To fully implement this support, the OSL
functions below must be implemented with UEFI interfaces. Any community
help in the implementation of these functions would be appreciated:
    AcpiOsReadPort
    AcpiOsWritePort
    AcpiOsReadMemory
    AcpiOsWriteMemory
    AcpiOsReadPciConfiguration
    AcpiOsWritePciConfiguration

Restructured and standardized the C library configuration for ACPICA,
resulting in the various configuration options below. This includes a
global restructuring of the compiler-dependent and platform-dependent
include files. These changes may affect the existing platform-dependent
configuration files on some hosts. Lv Zheng.

The current C library configuration options appear below. For any issues,
it may be helpful to examine the existing compiler-dependent and
platform-dependent files as examples. Lv Zheng.

1) Linux kernel:
    ACPI_USE_STANDARD_HEADERS=n in order not to use system-provided C
library.
    ACPI_USE_SYSTEM_CLIBRARY=y in order not to use ACPICA mini C library.
2) Unix/Windows/BSD applications:
    ACPI_USE_STANDARD_HEADERS=y in order to use system-provided C
library.
    ACPI_USE_SYSTEM_CLIBRARY=y in order not to use ACPICA mini C library.
3) UEFI applications:
    ACPI_USE_STANDARD_HEADERS=n in order not to use system-provided C
library.
    ACPI_USE_SYSTEM_CLIBRARY=n in order to use ACPICA mini C library.
4) UEFI applications (EDK2/StdLib):
    ACPI_USE_STANDARD_HEADERS=y in order to use EDK2 StdLib C library.
    ACPI_USE_SYSTEM_CLIBRARY=y in order to use EDK2 StdLib C library.


AML interpreter: "module-level code" support. Allows for execution of so-
called "executable" AML code (math/logical operations, etc.) outside of
control methods not just at the module level (top level) but also within
any scope declared outside of a control method - Scope{}, Device{},
Processor{}, PowerResource{}, and ThermalZone{}. Lv Zheng.

Simplified the configuration of the "maximum AML loops" global option by
adding a global public variable, "AcpiGbl_MaxLoopIterations" which can be
modified at runtime.


Example Code and Data Size: These are the sizes for the OS-independent
acpica.lib produced by the Microsoft Visual C++ 9.0 32-bit compiler. The
debug version of the code includes the debug output trace mechanism and
has a much larger code and data size.

  Current Release:
    Non-Debug Version: 139.1K Code, 22.9K Data, 162.0K Total
    Debug Version:     199.0K Code, 81.8K Data, 280.8K Total


2) iASL Compiler/Disassembler and Tools:

iASL: Add full support for the RASF ACPI table (RAS Features Table).
Includes disassembler, data table compiler, and header support.

iASL Expand "module-level code" support. Allows for
compilation/disassembly of so-called "executable" AML code (math/logical
operations, etc.) outside of control methods not just at the module level
(top level) but also within any scope declared outside of a control
method - Scope{}, Device{}, Processor{}, PowerResource{}, and
ThermalZone{}.

AcpiDump: Added support for dumping all SSDTs on newer versions of
Windows. These tables are now easily available -- SSDTs are not available
through the registry on older versions.

diffstat:

 sys/external/bsd/acpica/dist/utilities/uthex.c     |   51 ++-
 sys/external/bsd/acpica/dist/utilities/utinit.c    |    2 +-
 sys/external/bsd/acpica/dist/utilities/utnonansi.c |  432 +--------------------
 sys/external/bsd/acpica/dist/utilities/utpredef.c  |    2 -
 sys/external/bsd/acpica/dist/utilities/utprint.c   |  121 +++++-
 sys/external/bsd/acpica/dist/utilities/utxface.c   |    2 +-
 sys/external/bsd/acpica/dist/utilities/utxfinit.c  |    8 +-
 7 files changed, 162 insertions(+), 456 deletions(-)

diffs (truncated from 801 to 300 lines):

diff -r b84eb3f53f59 -r c322ec184139 sys/external/bsd/acpica/dist/utilities/uthex.c
--- a/sys/external/bsd/acpica/dist/utilities/uthex.c    Fri Nov 11 19:14:16 2016 +0000
+++ b/sys/external/bsd/acpica/dist/utilities/uthex.c    Fri Nov 11 19:24:26 2016 +0000
@@ -82,9 +82,46 @@
 
 /*******************************************************************************
  *
+ * FUNCTION:    AcpiUtAsciiToHexByte
+ *
+ * PARAMETERS:  TwoAsciiChars               - Pointer to two ASCII characters
+ *              ReturnByte                  - Where converted byte is returned
+ *
+ * RETURN:      Status and converted hex byte
+ *
+ * DESCRIPTION: Perform ascii-to-hex translation, exactly two ASCII characters
+ *              to a single converted byte value.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiUtAsciiToHexByte (
+    char                    *TwoAsciiChars,
+    UINT8                   *ReturnByte)
+{
+
+    /* Both ASCII characters must be valid hex digits */
+
+    if (!isxdigit ((int) TwoAsciiChars[0]) ||
+        !isxdigit ((int) TwoAsciiChars[1]))
+    {
+        return (AE_BAD_HEX_CONSTANT);
+    }
+
+    *ReturnByte =
+        AcpiUtAsciiCharToHex (TwoAsciiChars[1]) |
+        (AcpiUtAsciiCharToHex (TwoAsciiChars[0]) << 4);
+
+    return (AE_OK);
+}
+
+
+/*******************************************************************************
+ *
  * FUNCTION:    AcpiUtAsciiCharToHex
  *
- * PARAMETERS:  HexChar                 - Hex character in Ascii
+ * PARAMETERS:  HexChar                 - Hex character in Ascii. Must be:
+ *                                        0-9 or A-F or a-f
  *
  * RETURN:      The binary value of the ascii/hex character
  *
@@ -97,15 +134,21 @@
     int                     HexChar)
 {
 
-    if (HexChar <= 0x39)
+    /* Values 0-9 */
+
+    if (HexChar <= '9')
     {
-        return ((UINT8) (HexChar - 0x30));
+        return ((UINT8) (HexChar - '0'));
     }
 
-    if (HexChar <= 0x46)
+    /* Upper case A-F */
+
+    if (HexChar <= 'F')
     {
         return ((UINT8) (HexChar - 0x37));
     }
 
+    /* Lower case a-f */
+
     return ((UINT8) (HexChar - 0x57));
 }
diff -r b84eb3f53f59 -r c322ec184139 sys/external/bsd/acpica/dist/utilities/utinit.c
--- a/sys/external/bsd/acpica/dist/utilities/utinit.c   Fri Nov 11 19:14:16 2016 +0000
+++ b/sys/external/bsd/acpica/dist/utilities/utinit.c   Fri Nov 11 19:24:26 2016 +0000
@@ -226,7 +226,7 @@
     AcpiGbl_NextOwnerIdOffset           = 0;
     AcpiGbl_DebuggerConfiguration       = DEBUGGER_THREADING;
     AcpiGbl_OsiMutex                    = NULL;
-    AcpiGbl_MaxLoopIterations           = 0xFFFF;
+    AcpiGbl_MaxLoopIterations           = ACPI_MAX_LOOP_COUNT;
 
     /* Hardware oriented */
 
diff -r b84eb3f53f59 -r c322ec184139 sys/external/bsd/acpica/dist/utilities/utnonansi.c
--- a/sys/external/bsd/acpica/dist/utilities/utnonansi.c        Fri Nov 11 19:14:16 2016 +0000
+++ b/sys/external/bsd/acpica/dist/utilities/utnonansi.c        Fri Nov 11 19:24:26 2016 +0000
@@ -48,10 +48,9 @@
 #define _COMPONENT          ACPI_UTILITIES
         ACPI_MODULE_NAME    ("utnonansi")
 
-
 /*
- * Non-ANSI C library functions - strlwr, strupr, stricmp, and a 64-bit
- * version of strtoul.
+ * Non-ANSI C library functions - strlwr, strupr, stricmp, and "safe"
+ * string functions.
  */
 
 /*******************************************************************************
@@ -238,430 +237,3 @@
     return (FALSE);
 }
 #endif
-
-
-/*******************************************************************************
- *
- * FUNCTION:    AcpiUtStrtoul64
- *
- * PARAMETERS:  String                  - Null terminated string
- *              Base                    - Radix of the string: 16 or 10 or
- *                                        ACPI_ANY_BASE
- *              MaxIntegerByteWidth     - Maximum allowable integer,in bytes:
- *                                        4 or 8 (32 or 64 bits)
- *              RetInteger              - Where the converted integer is
- *                                        returned
- *
- * RETURN:      Status and Converted value
- *
- * DESCRIPTION: Convert a string into an unsigned value. Performs either a
- *              32-bit or 64-bit conversion, depending on the input integer
- *              size (often the current mode of the interpreter).
- *
- * NOTES:       Negative numbers are not supported, as they are not supported
- *              by ACPI.
- *
- *              AcpiGbl_IntegerByteWidth should be set to the proper width.
- *              For the core ACPICA code, this width depends on the DSDT
- *              version. For iASL, the default byte width is always 8 for the
- *              parser, but error checking is performed later to flag cases
- *              where a 64-bit constant is defined in a 32-bit DSDT/SSDT.
- *
- *              Does not support Octal strings, not needed at this time.
- *
- ******************************************************************************/
-
-ACPI_STATUS
-AcpiUtStrtoul64 (
-    char                    *String,
-    UINT32                  Base,
-    UINT32                  MaxIntegerByteWidth,
-    UINT64                  *RetInteger)
-{
-    UINT32                  ThisDigit = 0;
-    UINT64                  ReturnValue = 0;
-    UINT64                  Quotient;
-    UINT64                  Dividend;
-    UINT8                   ValidDigits = 0;
-    UINT8                   SignOf0x = 0;
-    UINT8                   Term = 0;
-
-
-    ACPI_FUNCTION_TRACE_STR (UtStrtoul64, String);
-
-
-    switch (Base)
-    {
-    case ACPI_ANY_BASE:
-    case 10:
-    case 16:
-
-        break;
-
-    default:
-
-        /* Invalid Base */
-
-        return_ACPI_STATUS (AE_BAD_PARAMETER);
-    }
-
-    if (!String)
-    {
-        goto ErrorExit;
-    }
-
-    /* Skip over any white space in the buffer */
-
-    while ((*String) && (isspace ((int) *String) || *String == '\t'))
-    {
-        String++;
-    }
-
-    if (Base == ACPI_ANY_BASE)
-    {
-        /*
-         * Base equal to ACPI_ANY_BASE means 'Either decimal or hex'.
-         * We need to determine if it is decimal or hexadecimal.
-         */
-        if ((*String == '0') && (tolower ((int) *(String + 1)) == 'x'))
-        {
-            SignOf0x = 1;
-            Base = 16;
-
-            /* Skip over the leading '0x' */
-            String += 2;
-        }
-        else
-        {
-            Base = 10;
-        }
-    }
-
-    /* Any string left? Check that '0x' is not followed by white space. */
-
-    if (!(*String) || isspace ((int) *String) || *String == '\t')
-    {
-        if (Base == ACPI_ANY_BASE)
-        {
-            goto ErrorExit;
-        }
-        else
-        {
-            goto AllDone;
-        }
-    }
-
-    /*
-     * Perform a 32-bit or 64-bit conversion, depending upon the input
-     * byte width
-     */
-    Dividend = (MaxIntegerByteWidth <= ACPI_MAX32_BYTE_WIDTH) ?
-        ACPI_UINT32_MAX : ACPI_UINT64_MAX;
-
-    /* Main loop: convert the string to a 32- or 64-bit integer */
-
-    while (*String)
-    {
-        if (isdigit ((int) *String))
-        {
-            /* Convert ASCII 0-9 to Decimal value */
-
-            ThisDigit = ((UINT8) *String) - '0';
-        }
-        else if (Base == 10)
-        {
-            /* Digit is out of range; possible in ToInteger case only */
-
-            Term = 1;
-        }
-        else
-        {
-            ThisDigit = (UINT8) toupper ((int) *String);
-            if (isxdigit ((int) ThisDigit))
-            {
-                /* Convert ASCII Hex char to value */
-
-                ThisDigit = ThisDigit - 'A' + 10;
-            }
-            else
-            {
-                Term = 1;
-            }
-        }
-
-        if (Term)
-        {
-            if (Base == ACPI_ANY_BASE)
-            {
-                goto ErrorExit;
-            }
-            else
-            {
-                break;
-            }
-        }
-        else if ((ValidDigits == 0) && (ThisDigit == 0) && !SignOf0x)
-        {
-            /* Skip zeros */
-            String++;
-            continue;
-        }
-
-        ValidDigits++;
-
-        if (SignOf0x && ((ValidDigits > 16) ||
-            ((ValidDigits > 8) && (MaxIntegerByteWidth <= ACPI_MAX32_BYTE_WIDTH))))
-        {
-            /*
-             * This is ToInteger operation case.
-             * No restrictions for string-to-integer conversion,
-             * see ACPI spec.
-             */
-            goto ErrorExit;
-        }
-
-        /* Divide the digit into the correct position */
-
-        (void) AcpiUtShortDivide (
-            (Dividend - (UINT64) ThisDigit), Base, &Quotient, NULL);
-
-        if (ReturnValue > Quotient)
-        {
-            if (Base == ACPI_ANY_BASE)
-            {
-                goto ErrorExit;



Home | Main Index | Thread Index | Old Index