[PATCH 2/2] ACPICA: Update to version 20160831
Colin King
colin.king at canonical.com
Thu Sep 1 13:44:50 UTC 2016
From: Colin Ian King <colin.king at canonical.com>
Changes in this release of ACPICA are detailed at the following
link on the ACPICA developer mailing list:
https://lists.acpica.org/pipermail/devel/2016-August/000955.html
Signed-off-by: Colin Ian King <colin.king at canonical.com>
---
src/acpica/Makefile.am | 1 +
src/acpica/source/common/adisasm.c | 2 +-
src/acpica/source/compiler/aslcompiler.h | 6 +-
src/acpica/source/compiler/aslmain.c | 320 ++++----------
src/acpica/source/compiler/aslopt.c | 2 +-
src/acpica/source/compiler/aslstubs.c | 15 +
src/acpica/source/compiler/aslutils.c | 67 +--
src/acpica/source/compiler/dtcompiler.h | 5 -
src/acpica/source/compiler/dtfield.c | 47 ++-
src/acpica/source/compiler/dtparser.y | 6 +-
src/acpica/source/compiler/dtutils.c | 87 ----
src/acpica/source/compiler/prparser.y | 4 +-
src/acpica/source/components/debugger/dbconvert.c | 3 +-
src/acpica/source/components/debugger/dbexec.c | 65 +--
src/acpica/source/components/debugger/dbinput.c | 1 +
src/acpica/source/components/debugger/dbmethod.c | 145 +++++++
.../source/components/disassembler/dmresrcl2.c | 6 +-
src/acpica/source/components/dispatcher/dsmethod.c | 14 +-
src/acpica/source/components/dispatcher/dswexec.c | 3 +-
src/acpica/source/components/dispatcher/dswload2.c | 8 +-
src/acpica/source/components/events/evgpe.c | 67 +++
src/acpica/source/components/events/evgpeinit.c | 7 +-
src/acpica/source/components/events/evrgnini.c | 3 +-
src/acpica/source/components/events/evxfgpe.c | 52 +++
src/acpica/source/components/executer/exconcat.c | 3 +-
src/acpica/source/components/executer/exconfig.c | 112 ++---
src/acpica/source/components/executer/exconvrt.c | 7 +-
src/acpica/source/components/executer/exmisc.c | 3 +-
src/acpica/source/components/executer/exoparg1.c | 7 +-
src/acpica/source/components/executer/exresop.c | 10 +-
src/acpica/source/components/executer/extrace.c | 28 --
src/acpica/source/components/executer/exutils.c | 10 +
src/acpica/source/components/hardware/hwgpe.c | 22 +-
src/acpica/source/components/namespace/nsconvert.c | 2 +-
src/acpica/source/components/namespace/nsload.c | 30 +-
src/acpica/source/components/namespace/nsparse.c | 181 ++++++--
src/acpica/source/components/namespace/nsutils.c | 68 ++-
src/acpica/source/components/parser/psparse.c | 5 +-
src/acpica/source/components/parser/psxface.c | 82 ++++
src/acpica/source/components/tables/tbdata.c | 158 +++++++
src/acpica/source/components/tables/tbfadt.c | 104 ++---
src/acpica/source/components/tables/tbfind.c | 10 +-
src/acpica/source/components/tables/tbinstal.c | 79 +---
src/acpica/source/components/tables/tbxfload.c | 55 +--
src/acpica/source/components/utilities/utaddress.c | 9 -
src/acpica/source/components/utilities/uthex.c | 51 ++-
src/acpica/source/components/utilities/utnonansi.c | 432 +------------------
src/acpica/source/components/utilities/utosi.c | 22 +-
.../source/components/utilities/utstrtoul64.c | 462 +++++++++++++++++++++
src/acpica/source/components/utilities/utxfinit.c | 2 +-
src/acpica/source/include/acdebug.h | 4 +-
src/acpica/source/include/acevents.h | 5 +
src/acpica/source/include/aclocal.h | 12 +-
src/acpica/source/include/acnamesp.h | 12 +
src/acpica/source/include/acparser.h | 4 +
src/acpica/source/include/acpixf.h | 16 +-
src/acpica/source/include/actables.h | 19 +-
src/acpica/source/include/actypes.h | 57 +--
src/acpica/source/include/acutils.h | 19 +-
src/acpica/source/tools/acpiexec/aehandlers.c | 2 +
src/acpica/source/tools/acpiexec/aeinitfile.c | 6 +-
61 files changed, 1714 insertions(+), 1332 deletions(-)
create mode 100644 src/acpica/source/components/utilities/utstrtoul64.c
diff --git a/src/acpica/Makefile.am b/src/acpica/Makefile.am
index 62aca07..a58d777 100644
--- a/src/acpica/Makefile.am
+++ b/src/acpica/Makefile.am
@@ -232,6 +232,7 @@ libfwtsacpica_la_SOURCES = \
source/components/utilities/utobject.c \
source/components/utilities/utresrc.c \
source/components/utilities/utstate.c \
+ source/components/utilities/utstrtoul64.c \
source/components/utilities/uttrack.c \
source/components/utilities/utosi.c \
source/components/utilities/utxferror.c \
diff --git a/src/acpica/source/common/adisasm.c b/src/acpica/source/common/adisasm.c
index 2d46c50..daaea05 100644
--- a/src/acpica/source/common/adisasm.c
+++ b/src/acpica/source/common/adisasm.c
@@ -698,7 +698,7 @@ AdDoExternalFileList (
AcpiDmFinishNamespaceLoad (AcpiGbl_ParseOpRoot,
AcpiGbl_RootNode, OwnerId);
AcpiPsDeleteParseTree (AcpiGbl_ParseOpRoot);
- AcpiGbl_ParseOpRoot = NULL;
+ AcpiGbl_ParseOpRoot = NULL; /* for fwts */
ExternalListHead = ExternalListHead->Next;
}
diff --git a/src/acpica/source/compiler/aslcompiler.h b/src/acpica/source/compiler/aslcompiler.h
index 64a9ae7..4e6cb9a 100644
--- a/src/acpica/source/compiler/aslcompiler.h
+++ b/src/acpica/source/compiler/aslcompiler.h
@@ -983,7 +983,7 @@ LkFindUnreferencedObjects (
void);
/*
- * aslmain - startup
+ * aslhelp - help screens
*/
void
Usage (
@@ -993,6 +993,10 @@ void
AslFilenameHelp (
void);
+void
+AslDisassemblyHelp (
+ void);
+
/*
* aslnamesp - namespace output file generation
diff --git a/src/acpica/source/compiler/aslmain.c b/src/acpica/source/compiler/aslmain.c
index 4233ad3..4167f6d 100644
--- a/src/acpica/source/compiler/aslmain.c
+++ b/src/acpica/source/compiler/aslmain.c
@@ -148,242 +148,15 @@ AslInitialize (
/*******************************************************************************
*
- * FUNCTION: Usage
- *
- * PARAMETERS: None
- *
- * RETURN: None
- *
- * DESCRIPTION: Display option help message.
- * Optional items in square brackets.
- *
- ******************************************************************************/
-
-void
-Usage (
- void)
-{
- printf ("%s\n\n", ASL_COMPLIANCE);
- ACPI_USAGE_HEADER ("iasl [Options] [Files]");
-
- printf ("\nGeneral:\n");
- ACPI_OPTION ("-@ <file>", "Specify command file");
- ACPI_OPTION ("-I <dir>", "Specify additional include directory");
- ACPI_OPTION ("-p <prefix>", "Specify path/filename prefix for all output files");
- ACPI_OPTION ("-v", "Display compiler version");
- ACPI_OPTION ("-vo", "Enable optimization comments");
- ACPI_OPTION ("-vs", "Disable signon");
-
- printf ("\nHelp:\n");
- ACPI_OPTION ("-h", "This message");
- ACPI_OPTION ("-hc", "Display operators allowed in constant expressions");
- ACPI_OPTION ("-hf", "Display help for output filename generation");
- ACPI_OPTION ("-hr", "Display ACPI reserved method names");
- ACPI_OPTION ("-ht", "Display currently supported ACPI table names");
-
- printf ("\nPreprocessor:\n");
- ACPI_OPTION ("-D <symbol>", "Define symbol for preprocessor use");
- ACPI_OPTION ("-li", "Create preprocessed output file (*.i)");
- ACPI_OPTION ("-P", "Preprocess only and create preprocessor output file (*.i)");
- ACPI_OPTION ("-Pn", "Disable preprocessor");
-
- printf ("\nErrors, Warnings, and Remarks:\n");
- ACPI_OPTION ("-va", "Disable all errors/warnings/remarks");
- ACPI_OPTION ("-ve", "Report only errors (ignore warnings and remarks)");
- ACPI_OPTION ("-vi", "Less verbose errors and warnings for use with IDEs");
- ACPI_OPTION ("-vr", "Disable remarks");
- ACPI_OPTION ("-vw <messageid>", "Disable specific warning or remark");
- ACPI_OPTION ("-w <1|2|3>", "Set warning reporting level");
- ACPI_OPTION ("-we", "Report warnings as errors");
-
- printf ("\nAML Code Generation (*.aml):\n");
- ACPI_OPTION ("-oa", "Disable all optimizations (compatibility mode)");
- ACPI_OPTION ("-of", "Disable constant folding");
- ACPI_OPTION ("-oi", "Disable integer optimization to Zero/One/Ones");
- ACPI_OPTION ("-on", "Disable named reference string optimization");
- ACPI_OPTION ("-ot", "Disable typechecking");
- ACPI_OPTION ("-cr", "Disable Resource Descriptor error checking");
- ACPI_OPTION ("-in", "Ignore NoOp operators");
- ACPI_OPTION ("-r <revision>", "Override table header Revision (1-255)");
-
- printf ("\nListings:\n");
- ACPI_OPTION ("-l", "Create mixed listing file (ASL source and AML) (*.lst)");
- ACPI_OPTION ("-lm", "Create hardware summary map file (*.map)");
- ACPI_OPTION ("-ln", "Create namespace file (*.nsp)");
- ACPI_OPTION ("-ls", "Create combined source file (expanded includes) (*.src)");
- ACPI_OPTION ("-lx", "Create cross-reference file (*.xrf)");
-
- printf ("\nFirmware Support - C Output:\n");
- ACPI_OPTION ("-tc", "Create hex AML table in C (*.hex)");
- ACPI_OPTION ("-sc", "Create named hex AML arrays in C (*.c)");
- ACPI_OPTION ("-ic", "Create include file in C for -sc symbols (*.h)");
- ACPI_OPTION ("-so", "Create namespace AML offset table in C (*.offset.h)");
-
- printf ("\nFirmware Support - Assembler Output:\n");
- ACPI_OPTION ("-ta", "Create hex AML table in assembler (*.hex)");
- ACPI_OPTION ("-sa", "Create named hex AML arrays in assembler (*.asm)");
- ACPI_OPTION ("-ia", "Create include file in assembler for -sa symbols (*.inc)");
-
- printf ("\nFirmware Support - ASL Output:\n");
- ACPI_OPTION ("-ts", "Create hex AML table in ASL (Buffer object) (*.hex)");
-
- printf ("\nData Table Compiler:\n");
- ACPI_OPTION ("-G", "Compile custom table that contains generic operators");
- ACPI_OPTION ("-T <sig list>|ALL", "Create ACPI table template/example files");
- ACPI_OPTION ("-T <count>", "Emit DSDT and <count> SSDTs to same file");
- ACPI_OPTION ("-vt", "Create verbose template files (full disassembly)");
-
- printf ("\nAML Disassembler:\n");
- ACPI_OPTION ("-d <f1 f2 ...>", "Disassemble or decode binary ACPI tables to file (*.dsl)");
- ACPI_OPTION ("", " (Optional, file type is automatically detected)");
- ACPI_OPTION ("-da <f1 f2 ...>", "Disassemble multiple tables from single namespace");
- ACPI_OPTION ("-db", "Do not translate Buffers to Resource Templates");
- ACPI_OPTION ("-dc <f1 f2 ...>", "Disassemble AML and immediately compile it");
- ACPI_OPTION ("", " (Obtain DSDT from current system if no input file)");
- ACPI_OPTION ("-df", "Force disassembler to assume table contains valid AML");
- ACPI_OPTION ("-dl", "Emit legacy ASL code only (no C-style operators)");
- ACPI_OPTION ("-e <f1 f2 ...>", "Include ACPI table(s) for external symbol resolution");
- ACPI_OPTION ("-fe <file>", "Specify external symbol declaration file");
- ACPI_OPTION ("-in", "Ignore NoOp opcodes");
- ACPI_OPTION ("-l", "Disassemble to mixed ASL and AML code");
- ACPI_OPTION ("-vt", "Dump binary table data in hex format within output file");
-
- printf ("\nDebug Options:\n");
- ACPI_OPTION ("-bf", "Create debug file (full output) (*.txt)");
- ACPI_OPTION ("-bs", "Create debug file (parse tree only) (*.txt)");
- ACPI_OPTION ("-bp <depth>", "Prune ASL parse tree");
- ACPI_OPTION ("-bt <type>", "Object type to be pruned from the parse tree");
- ACPI_OPTION ("-f", "Ignore errors, force creation of AML output file(s)");
- ACPI_OPTION ("-m <size>", "Set internal line buffer size (in Kbytes)");
- ACPI_OPTION ("-n", "Parse only, no output generation");
- ACPI_OPTION ("-oc", "Display compile times and statistics");
- ACPI_OPTION ("-x <level>", "Set debug level for trace output");
- ACPI_OPTION ("-z", "Do not insert new compiler ID for DataTables");
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: FilenameHelp
- *
- * PARAMETERS: None
- *
- * RETURN: None
- *
- * DESCRIPTION: Display help message for output filename generation
- *
- ******************************************************************************/
-
-void
-AslFilenameHelp (
- void)
-{
-
- printf ("\nAML output filename generation:\n");
- printf (" Output filenames are generated by appending an extension to a common\n");
- printf (" filename prefix. The filename prefix is obtained via one of the\n");
- printf (" following methods (in priority order):\n");
- printf (" 1) The -p option specifies the prefix\n");
- printf (" 2) The prefix of the AMLFileName in the ASL Definition Block\n");
- printf (" 3) The prefix of the input filename\n");
- printf ("\n");
-}
-
-
-/******************************************************************************
- *
- * FUNCTION: AslSignalHandler
- *
- * PARAMETERS: Sig - Signal that invoked this handler
- *
- * RETURN: None
- *
- * DESCRIPTION: Control-C handler. Delete any intermediate files and any
- * output files that may be left in an indeterminate state.
- *
- *****************************************************************************/
-
-static void ACPI_SYSTEM_XFACE
-AslSignalHandler (
- int Sig)
-{
- UINT32 i;
-
-
- signal (Sig, SIG_IGN);
- printf ("Aborting\n\n");
-
- /* Close all open files */
-
- Gbl_Files[ASL_FILE_PREPROCESSOR].Handle = NULL; /* the .pre file is same as source file */
-
- for (i = ASL_FILE_INPUT; i < ASL_MAX_FILE_TYPE; i++)
- {
- FlCloseFile (i);
- }
-
- /* Delete any output files */
-
- for (i = ASL_FILE_AML_OUTPUT; i < ASL_MAX_FILE_TYPE; i++)
- {
- FlDeleteFile (i);
- }
-
- exit (0);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: AslInitialize
- *
- * PARAMETERS: None
- *
- * RETURN: None
- *
- * DESCRIPTION: Initialize compiler globals
- *
- ******************************************************************************/
-
-static void
-AslInitialize (
- void)
-{
- UINT32 i;
-
-
- AcpiGbl_DmOpt_Verbose = FALSE;
-
- /* Default integer width is 64 bits */
-
- AcpiGbl_IntegerBitWidth = 64;
- AcpiGbl_IntegerNybbleWidth = 16;
- AcpiGbl_IntegerByteWidth = 8;
-
- for (i = 0; i < ASL_NUM_FILES; i++)
- {
- Gbl_Files[i].Handle = NULL;
- Gbl_Files[i].Filename = NULL;
- }
-
- Gbl_Files[ASL_FILE_STDOUT].Handle = stdout;
- Gbl_Files[ASL_FILE_STDOUT].Filename = "STDOUT";
-
- Gbl_Files[ASL_FILE_STDERR].Handle = stderr;
- Gbl_Files[ASL_FILE_STDERR].Filename = "STDERR";
-}
-
-
-/*******************************************************************************
- *
* FUNCTION: main
*
* PARAMETERS: Standard argc/argv
*
* RETURN: Program termination code
*
- * DESCRIPTION: C main routine for the Asl Compiler. Handle command line
- * options and begin the compile for each file on the command line
+ * DESCRIPTION: C main routine for the iASL Compiler/Disassembler. Process
+ * command line options and begin the compile/disassembly for each file on
+ * the command line (wildcards supported).
*
******************************************************************************/
@@ -421,7 +194,8 @@ main (
PrInitializePreprocessor ();
AslInitialize ();
- Index1 = Index2 = AslCommandLine (argc, argv);
+ Index1 = Index2 =
+ AslCommandLine (argc, argv);
/* Allocate the line buffer(s), must be after command line */
@@ -481,3 +255,87 @@ CleanupAndExit:
return (ReturnStatus);
}
+
+
+/******************************************************************************
+ *
+ * FUNCTION: AslSignalHandler
+ *
+ * PARAMETERS: Sig - Signal that invoked this handler
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Control-C handler. Delete any intermediate files and any
+ * output files that may be left in an indeterminate state.
+ *
+ *****************************************************************************/
+
+static void ACPI_SYSTEM_XFACE
+AslSignalHandler (
+ int Sig)
+{
+ UINT32 i;
+
+
+ signal (Sig, SIG_IGN);
+ printf ("Aborting\n\n");
+
+ /* Close all open files */
+
+ Gbl_Files[ASL_FILE_PREPROCESSOR].Handle = NULL; /* the .pre file is same as source file */
+
+ for (i = ASL_FILE_INPUT; i < ASL_MAX_FILE_TYPE; i++)
+ {
+ FlCloseFile (i);
+ }
+
+ /* Delete any output files */
+
+ for (i = ASL_FILE_AML_OUTPUT; i < ASL_MAX_FILE_TYPE; i++)
+ {
+ FlDeleteFile (i);
+ }
+
+ exit (0);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AslInitialize
+ *
+ * PARAMETERS: None
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Initialize compiler globals
+ *
+ ******************************************************************************/
+
+static void
+AslInitialize (
+ void)
+{
+ UINT32 i;
+
+
+ AcpiGbl_DmOpt_Verbose = FALSE;
+
+ /* Default integer width is 64 bits */
+
+ AcpiGbl_IntegerBitWidth = 64;
+ AcpiGbl_IntegerNybbleWidth = 16;
+ AcpiGbl_IntegerByteWidth = 8;
+
+ for (i = 0; i < ASL_NUM_FILES; i++)
+ {
+ Gbl_Files[i].Handle = NULL;
+ Gbl_Files[i].Filename = NULL;
+ }
+
+ Gbl_Files[ASL_FILE_STDOUT].Handle = stdout;
+ Gbl_Files[ASL_FILE_STDOUT].Filename = "STDOUT";
+
+ Gbl_Files[ASL_FILE_STDERR].Handle = stderr;
+ Gbl_Files[ASL_FILE_STDERR].Filename = "STDERR";
+}
diff --git a/src/acpica/source/compiler/aslopt.c b/src/acpica/source/compiler/aslopt.c
index ab8a931..c46d5c3 100644
--- a/src/acpica/source/compiler/aslopt.c
+++ b/src/acpica/source/compiler/aslopt.c
@@ -205,7 +205,7 @@ OptSearchToRoot (
* not match, and we cannot use this optimization.
*/
Path = &(((char *) TargetPath->Pointer)[
- TargetPath->Length - ACPI_NAME_SIZE]),
+ TargetPath->Length - ACPI_NAME_SIZE]);
ScopeInfo.Scope.Node = CurrentNode;
/* Lookup the NameSeg using SEARCH_PARENT (search-to-root) */
diff --git a/src/acpica/source/compiler/aslstubs.c b/src/acpica/source/compiler/aslstubs.c
index 1ae9e2a..995d355 100644
--- a/src/acpica/source/compiler/aslstubs.c
+++ b/src/acpica/source/compiler/aslstubs.c
@@ -119,6 +119,7 @@
#include "acevents.h"
#include "acinterp.h"
#include "acnamesp.h"
+#include "acparser.h"
#define _COMPONENT ACPI_COMPILER
ACPI_MODULE_NAME ("aslstubs")
@@ -143,6 +144,13 @@ AcpiNsInitializeObjects (
}
ACPI_STATUS
+AcpiPsExecuteTable (
+ ACPI_EVALUATE_INFO *Info)
+{
+ return (AE_OK);
+}
+
+ACPI_STATUS
AcpiHwReadPort (
ACPI_IO_ADDRESS Address,
UINT32 *Value,
@@ -228,6 +236,13 @@ AcpiEvDeleteGpeBlock (
return (AE_OK);
}
+void
+AcpiEvUpdateGpes (
+ ACPI_OWNER_ID TableOwnerId)
+{
+ return;
+}
+
ACPI_STATUS
AcpiEvAcquireGlobalLock (
UINT16 Timeout)
diff --git a/src/acpica/source/compiler/aslutils.c b/src/acpica/source/compiler/aslutils.c
index 1b7e844..5889459 100644
--- a/src/acpica/source/compiler/aslutils.c
+++ b/src/acpica/source/compiler/aslutils.c
@@ -961,7 +961,7 @@ UtAttachNamepathToOwner (
*
* FUNCTION: UtDoConstant
*
- * PARAMETERS: String - Hex, Octal, or Decimal string
+ * PARAMETERS: String - Hexadecimal or decimal string
*
* RETURN: Converted Integer
*
@@ -978,9 +978,7 @@ UtDoConstant (
char ErrBuf[64];
- Status = AcpiUtStrtoul64 (String, ACPI_ANY_BASE,
- ACPI_MAX64_BYTE_WIDTH, &Converted);
-
+ Status = AcpiUtStrtoul64 (String, ACPI_STRTOUL_64BIT, &Converted);
if (ACPI_FAILURE (Status))
{
sprintf (ErrBuf, "%s %s\n", "Conversion error:",
@@ -990,64 +988,3 @@ UtDoConstant (
return (Converted);
}
-
-
-#ifdef _OBSOLETE_FUNCTIONS
-/* Removed 01/2016 */
-
-/*******************************************************************************
- *
- * FUNCTION: UtConvertByteToHex
- *
- * PARAMETERS: RawByte - Binary data
- * Buffer - Pointer to where the hex bytes will be
- * stored
- *
- * RETURN: Ascii hex byte is stored in Buffer.
- *
- * DESCRIPTION: Perform hex-to-ascii translation. The return data is prefixed
- * with "0x"
- *
- ******************************************************************************/
-
-void
-UtConvertByteToHex (
- UINT8 RawByte,
- UINT8 *Buffer)
-{
-
- Buffer[0] = '0';
- Buffer[1] = 'x';
-
- Buffer[2] = (UINT8) AcpiUtHexToAsciiChar (RawByte, 4);
- Buffer[3] = (UINT8) AcpiUtHexToAsciiChar (RawByte, 0);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: UtConvertByteToAsmHex
- *
- * PARAMETERS: RawByte - Binary data
- * Buffer - Pointer to where the hex bytes will be
- * stored
- *
- * RETURN: Ascii hex byte is stored in Buffer.
- *
- * DESCRIPTION: Perform hex-to-ascii translation. The return data is prefixed
- * with '0', and a trailing 'h' is added.
- *
- ******************************************************************************/
-
-void
-UtConvertByteToAsmHex (
- UINT8 RawByte,
- UINT8 *Buffer)
-{
-
- Buffer[0] = '0';
- Buffer[1] = (UINT8) AcpiUtHexToAsciiChar (RawByte, 4);
- Buffer[2] = (UINT8) AcpiUtHexToAsciiChar (RawByte, 0);
- Buffer[3] = 'h';
-}
-#endif /* OBSOLETE_FUNCTIONS */
diff --git a/src/acpica/source/compiler/dtcompiler.h b/src/acpica/source/compiler/dtcompiler.h
index 1072f52..af498d8 100644
--- a/src/acpica/source/compiler/dtcompiler.h
+++ b/src/acpica/source/compiler/dtcompiler.h
@@ -445,11 +445,6 @@ DtFatal (
DT_FIELD *FieldObject,
char *ExtraMessage);
-ACPI_STATUS
-DtStrtoul64 (
- char *String,
- UINT64 *ReturnInteger);
-
char*
DtGetFieldValue (
DT_FIELD *Field);
diff --git a/src/acpica/source/compiler/dtfield.c b/src/acpica/source/compiler/dtfield.c
index d6da135..69d6415 100644
--- a/src/acpica/source/compiler/dtfield.c
+++ b/src/acpica/source/compiler/dtfield.c
@@ -442,10 +442,10 @@ DtCompileInteger (
* FUNCTION: DtNormalizeBuffer
*
* PARAMETERS: Buffer - Input buffer
- * Count - Output the count of hex number in
+ * Count - Output the count of hex numbers in
* the Buffer
*
- * RETURN: The normalized buffer, freed by caller
+ * RETURN: The normalized buffer, must be freed by caller
*
* DESCRIPTION: [1A,2B,3C,4D] or 1A, 2B, 3C, 4D will be normalized
* to 1A 2B 3C 4D
@@ -529,36 +529,38 @@ DtCompileBuffer (
DT_FIELD *Field,
UINT32 ByteLength)
{
+ char *Substring;
ACPI_STATUS Status;
- char Hex[3];
- UINT64 Value;
- UINT32 i;
UINT32 Count;
+ UINT32 i;
/* Allow several different types of value separators */
StringValue = DtNormalizeBuffer (StringValue, &Count);
+ Substring = StringValue;
- Hex[2] = 0;
- for (i = 0; i < Count; i++)
+ /* Each element of StringValue is now three chars (2 hex + 1 space) */
+
+ for (i = 0; i < Count; i++, Substring += 3)
{
- /* Each element of StringValue is three chars */
+ /* Check for byte value too long */
- Hex[0] = StringValue[(3 * i)];
- Hex[1] = StringValue[(3 * i) + 1];
+ if (*(&Substring[2]) &&
+ (*(&Substring[2]) != ' '))
+ {
+ DtError (ASL_ERROR, ASL_MSG_BUFFER_ELEMENT, Field, Substring);
+ goto Exit;
+ }
- /* Convert one hex byte */
+ /* Convert two ASCII characters to one hex byte */
- Value = 0;
- Status = DtStrtoul64 (Hex, &Value);
+ Status = AcpiUtAsciiToHexByte (Substring, &Buffer[i]);
if (ACPI_FAILURE (Status))
{
- DtError (ASL_ERROR, ASL_MSG_BUFFER_ELEMENT, Field, MsgBuffer);
+ DtError (ASL_ERROR, ASL_MSG_BUFFER_ELEMENT, Field, Substring);
goto Exit;
}
-
- Buffer[i] = (UINT8) Value;
}
Exit:
@@ -571,13 +573,13 @@ Exit:
*
* FUNCTION: DtCompileFlag
*
- * PARAMETERS: Buffer - Output buffer
- * Field - Field to be compiled
- * Info - Flag info
+ * PARAMETERS: Buffer - Output buffer
+ * Field - Field to be compiled
+ * Info - Flag info
*
- * RETURN:
+ * RETURN: None
*
- * DESCRIPTION: Compile a flag
+ * DESCRIPTION: Compile a flag field. Handles flags up to 64 bits.
*
*****************************************************************************/
@@ -593,7 +595,8 @@ DtCompileFlag (
ACPI_STATUS Status;
- Status = DtStrtoul64 (Field->Value, &Value);
+ Status = AcpiUtStrtoul64 (Field->Value,
+ (ACPI_STRTOUL_64BIT | ACPI_STRTOUL_BASE16), &Value);
if (ACPI_FAILURE (Status))
{
DtError (ASL_ERROR, ASL_MSG_INVALID_HEX_INTEGER, Field, NULL);
diff --git a/src/acpica/source/compiler/dtparser.y b/src/acpica/source/compiler/dtparser.y
index cf61ff2..81d9324 100644
--- a/src/acpica/source/compiler/dtparser.y
+++ b/src/acpica/source/compiler/dtparser.y
@@ -241,15 +241,15 @@ Expression
/* Default base for a non-prefixed integer is 16 */
- | EXPOP_NUMBER { AcpiUtStrtoul64 (DtParsertext, 16, ACPI_MAX64_BYTE_WIDTH, &$$);}
+ | EXPOP_NUMBER { AcpiUtStrtoul64 (DtParsertext, (ACPI_STRTOUL_BASE16 | ACPI_STRTOUL_64BIT), &$$);}
/* Standard hex number (0x1234) */
- | EXPOP_HEX_NUMBER { AcpiUtStrtoul64 (DtParsertext, 16, ACPI_MAX64_BYTE_WIDTH, &$$);}
+ | EXPOP_HEX_NUMBER { AcpiUtStrtoul64 (DtParsertext, (ACPI_STRTOUL_BASE16 | ACPI_STRTOUL_64BIT), &$$);}
/* TBD: Decimal number with prefix (0d1234) - Not supported by strtoul64 at this time */
- | EXPOP_DECIMAL_NUMBER { AcpiUtStrtoul64 (DtParsertext, 10, ACPI_MAX64_BYTE_WIDTH, &$$);}
+ | EXPOP_DECIMAL_NUMBER { AcpiUtStrtoul64 (DtParsertext, ACPI_STRTOUL_64BIT, &$$);}
;
%%
diff --git a/src/acpica/source/compiler/dtutils.c b/src/acpica/source/compiler/dtutils.c
index fa12b51..aa938ff 100644
--- a/src/acpica/source/compiler/dtutils.c
+++ b/src/acpica/source/compiler/dtutils.c
@@ -269,93 +269,6 @@ DtFatal (
/******************************************************************************
*
- * FUNCTION: DtStrtoul64
- *
- * PARAMETERS: String - Null terminated string
- * ReturnInteger - Where the converted integer is returned
- *
- * RETURN: Status
- *
- * DESCRIPTION: Simple conversion of a string hex integer constant to unsigned
- * value. Assumes no leading "0x" for the constant.
- *
- * Portability note: The reason this function exists is because a 64-bit
- * sscanf is not available in all environments.
- *
- *****************************************************************************/
-
-ACPI_STATUS
-DtStrtoul64 (
- char *String,
- UINT64 *ReturnInteger)
-{
- char *ThisChar = String;
- UINT32 ThisDigit;
- UINT64 ReturnValue = 0;
- int DigitCount = 0;
-
-
- /* Skip over any white space in the buffer */
-
- while ((*ThisChar == ' ') || (*ThisChar == '\t'))
- {
- ThisChar++;
- }
-
- /* Skip leading zeros */
-
- while ((*ThisChar) == '0')
- {
- ThisChar++;
- }
-
- /* Convert character-by-character */
-
- while (*ThisChar)
- {
- if (isdigit ((int) *ThisChar))
- {
- /* Convert ASCII 0-9 to Decimal value */
-
- ThisDigit = ((UINT8) *ThisChar) - '0';
- }
- else /* Letter */
- {
- ThisDigit = (UINT32) toupper ((int) *ThisChar);
- if (!isxdigit ((int) ThisDigit))
- {
- /* Not A-F */
-
- return (AE_BAD_CHARACTER);
- }
-
- /* Convert ASCII Hex char (A-F) to value */
-
- ThisDigit = (ThisDigit - 'A') + 10;
- }
-
- /* Insert the 4-bit hex digit */
-
- ReturnValue <<= 4;
- ReturnValue += ThisDigit;
-
- ThisChar++;
- DigitCount++;
- if (DigitCount > 16)
- {
- /* Value is too large (> 64 bits/8 bytes/16 hex digits) */
-
- return (AE_LIMIT);
- }
- }
-
- *ReturnInteger = ReturnValue;
- return (AE_OK);
-}
-
-
-/******************************************************************************
- *
* FUNCTION: DtGetFieldValue
*
* PARAMETERS: Field - Current field list pointer
diff --git a/src/acpica/source/compiler/prparser.y b/src/acpica/source/compiler/prparser.y
index 127701e..362a7e6 100644
--- a/src/acpica/source/compiler/prparser.y
+++ b/src/acpica/source/compiler/prparser.y
@@ -254,11 +254,11 @@ Expression
/* Default base for a non-prefixed integer is 10 */
- | EXPOP_NUMBER { AcpiUtStrtoul64 (PrParsertext, 10, ACPI_MAX64_BYTE_WIDTH, &$$);}
+ | EXPOP_NUMBER { AcpiUtStrtoul64 (PrParsertext, ACPI_STRTOUL_64BIT, &$$);}
/* Standard hex number (0x1234) */
- | EXPOP_HEX_NUMBER { AcpiUtStrtoul64 (PrParsertext, 16, ACPI_MAX64_BYTE_WIDTH, &$$);}
+ | EXPOP_HEX_NUMBER { AcpiUtStrtoul64 (PrParsertext, (ACPI_STRTOUL_BASE16 | ACPI_STRTOUL_64BIT), &$$);}
;
%%
diff --git a/src/acpica/source/components/debugger/dbconvert.c b/src/acpica/source/components/debugger/dbconvert.c
index 1b36e63..3c448a7 100644
--- a/src/acpica/source/components/debugger/dbconvert.c
+++ b/src/acpica/source/components/debugger/dbconvert.c
@@ -393,7 +393,8 @@ AcpiDbConvertToObject (
default:
Object->Type = ACPI_TYPE_INTEGER;
- Status = AcpiUtStrtoul64 (String, 16, AcpiGbl_IntegerByteWidth,
+ Status = AcpiUtStrtoul64 (String,
+ (AcpiGbl_IntegerByteWidth | ACPI_STRTOUL_BASE16),
&Object->Integer.Value);
break;
}
diff --git a/src/acpica/source/components/debugger/dbexec.c b/src/acpica/source/components/debugger/dbexec.c
index de49eeff..f07fd06 100644
--- a/src/acpica/source/components/debugger/dbexec.c
+++ b/src/acpica/source/components/debugger/dbexec.c
@@ -516,44 +516,51 @@ AcpiDbExecute (
ACPI_UINT32_MAX, AcpiDbExecutionWalk, NULL, NULL, NULL);
return;
}
- else
+
+ NameString = ACPI_ALLOCATE (strlen (Name) + 1);
+ if (!NameString)
{
- NameString = ACPI_ALLOCATE (strlen (Name) + 1);
- if (!NameString)
- {
- return;
- }
+ return;
+ }
- memset (&AcpiGbl_DbMethodInfo, 0, sizeof (ACPI_DB_METHOD_INFO));
+ memset (&AcpiGbl_DbMethodInfo, 0, sizeof (ACPI_DB_METHOD_INFO));
+ strcpy (NameString, Name);
+ AcpiUtStrupr (NameString);
- strcpy (NameString, Name);
- AcpiUtStrupr (NameString);
- AcpiGbl_DbMethodInfo.Name = NameString;
- AcpiGbl_DbMethodInfo.Args = Args;
- AcpiGbl_DbMethodInfo.Types = Types;
- AcpiGbl_DbMethodInfo.Flags = Flags;
+ /* Subcommand to Execute all predefined names in the namespace */
- ReturnObj.Pointer = NULL;
- ReturnObj.Length = ACPI_ALLOCATE_BUFFER;
+ if (!strncmp (NameString, "PREDEF", 6))
+ {
+ AcpiDbEvaluatePredefinedNames ();
+ ACPI_FREE (NameString);
+ return;
+ }
- Status = AcpiDbExecuteSetup (&AcpiGbl_DbMethodInfo);
- if (ACPI_FAILURE (Status))
- {
- ACPI_FREE (NameString);
- return;
- }
+ AcpiGbl_DbMethodInfo.Name = NameString;
+ AcpiGbl_DbMethodInfo.Args = Args;
+ AcpiGbl_DbMethodInfo.Types = Types;
+ AcpiGbl_DbMethodInfo.Flags = Flags;
- /* Get the NS node, determines existence also */
+ ReturnObj.Pointer = NULL;
+ ReturnObj.Length = ACPI_ALLOCATE_BUFFER;
- Status = AcpiGetHandle (NULL, AcpiGbl_DbMethodInfo.Pathname,
- &AcpiGbl_DbMethodInfo.Method);
- if (ACPI_SUCCESS (Status))
- {
- Status = AcpiDbExecuteMethod (&AcpiGbl_DbMethodInfo,
- &ReturnObj);
- }
+ Status = AcpiDbExecuteSetup (&AcpiGbl_DbMethodInfo);
+ if (ACPI_FAILURE (Status))
+ {
ACPI_FREE (NameString);
+ return;
+ }
+
+ /* Get the NS node, determines existence also */
+
+ Status = AcpiGetHandle (NULL, AcpiGbl_DbMethodInfo.Pathname,
+ &AcpiGbl_DbMethodInfo.Method);
+ if (ACPI_SUCCESS (Status))
+ {
+ Status = AcpiDbExecuteMethod (&AcpiGbl_DbMethodInfo,
+ &ReturnObj);
}
+ ACPI_FREE (NameString);
/*
* Allow any handlers in separate threads to complete.
diff --git a/src/acpica/source/components/debugger/dbinput.c b/src/acpica/source/components/debugger/dbinput.c
index 7a31c58..f41ad81 100644
--- a/src/acpica/source/components/debugger/dbinput.c
+++ b/src/acpica/source/components/debugger/dbinput.c
@@ -370,6 +370,7 @@ static const ACPI_DB_COMMAND_HELP AcpiGbl_DbCommandHelp[] =
{1, " \"Ascii String\"", "String method argument\n"},
{1, " (Hex Byte List)", "Buffer method argument\n"},
{1, " [Package Element List]", "Package method argument\n"},
+ {5, " Execute predefined", "Execute all predefined (public) methods\n"},
{1, " Go", "Allow method to run to completion\n"},
{1, " Information", "Display info about the current method\n"},
{1, " Into", "Step into (not over) a method call\n"},
diff --git a/src/acpica/source/components/debugger/dbmethod.c b/src/acpica/source/components/debugger/dbmethod.c
index ded1602..5756ecb 100644
--- a/src/acpica/source/components/debugger/dbmethod.c
+++ b/src/acpica/source/components/debugger/dbmethod.c
@@ -125,6 +125,15 @@
#define _COMPONENT ACPI_CA_DEBUGGER
ACPI_MODULE_NAME ("dbmethod")
+/* Local prototypes */
+
+static ACPI_STATUS
+AcpiDbWalkForExecute (
+ ACPI_HANDLE ObjHandle,
+ UINT32 NestingLevel,
+ void *Context,
+ void **ReturnValue);
+
/*******************************************************************************
*
@@ -486,3 +495,139 @@ AcpiDbDisassembleMethod (
AcpiUtReleaseOwnerId (&ObjDesc->Method.OwnerId);
return (AE_OK);
}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDbWalkForExecute
+ *
+ * PARAMETERS: Callback from WalkNamespace
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Batch execution module. Currently only executes predefined
+ * ACPI names.
+ *
+ ******************************************************************************/
+
+static ACPI_STATUS
+AcpiDbWalkForExecute (
+ ACPI_HANDLE ObjHandle,
+ UINT32 NestingLevel,
+ void *Context,
+ void **ReturnValue)
+{
+ ACPI_NAMESPACE_NODE *Node = (ACPI_NAMESPACE_NODE *) ObjHandle;
+ ACPI_DB_EXECUTE_WALK *Info = (ACPI_DB_EXECUTE_WALK *) Context;
+ ACPI_BUFFER ReturnObj;
+ ACPI_STATUS Status;
+ char *Pathname;
+ UINT32 i;
+ ACPI_DEVICE_INFO *ObjInfo;
+ ACPI_OBJECT_LIST ParamObjects;
+ ACPI_OBJECT Params[ACPI_METHOD_NUM_ARGS];
+ const ACPI_PREDEFINED_INFO *Predefined;
+
+
+ Predefined = AcpiUtMatchPredefinedMethod (Node->Name.Ascii);
+ if (!Predefined)
+ {
+ return (AE_OK);
+ }
+
+ if (Node->Type == ACPI_TYPE_LOCAL_SCOPE)
+ {
+ return (AE_OK);
+ }
+
+ Pathname = AcpiNsGetExternalPathname (Node);
+ if (!Pathname)
+ {
+ return (AE_OK);
+ }
+
+ /* Get the object info for number of method parameters */
+
+ Status = AcpiGetObjectInfo (ObjHandle, &ObjInfo);
+ if (ACPI_FAILURE (Status))
+ {
+ return (Status);
+ }
+
+ ParamObjects.Pointer = NULL;
+ ParamObjects.Count = 0;
+
+ if (ObjInfo->Type == ACPI_TYPE_METHOD)
+ {
+ /* Setup default parameters */
+
+ for (i = 0; i < ObjInfo->ParamCount; i++)
+ {
+ Params[i].Type = ACPI_TYPE_INTEGER;
+ Params[i].Integer.Value = 1;
+ }
+
+ ParamObjects.Pointer = Params;
+ ParamObjects.Count = ObjInfo->ParamCount;
+ }
+
+ ACPI_FREE (ObjInfo);
+ ReturnObj.Pointer = NULL;
+ ReturnObj.Length = ACPI_ALLOCATE_BUFFER;
+
+ /* Do the actual method execution */
+
+ AcpiGbl_MethodExecuting = TRUE;
+
+ Status = AcpiEvaluateObject (Node, NULL, &ParamObjects, &ReturnObj);
+
+ AcpiOsPrintf ("%-32s returned %s\n", Pathname, AcpiFormatException (Status));
+ AcpiGbl_MethodExecuting = FALSE;
+ ACPI_FREE (Pathname);
+
+ /* Ignore status from method execution */
+
+ Status = AE_OK;
+
+ /* Update count, check if we have executed enough methods */
+
+ Info->Count++;
+ if (Info->Count >= Info->MaxCount)
+ {
+ Status = AE_CTRL_TERMINATE;
+ }
+
+ return (Status);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDbEvaluatePredefinedNames
+ *
+ * PARAMETERS: None
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Namespace batch execution. Execute predefined names in the
+ * namespace, up to the max count, if specified.
+ *
+ ******************************************************************************/
+
+void
+AcpiDbEvaluatePredefinedNames (
+ void)
+{
+ ACPI_DB_EXECUTE_WALK Info;
+
+
+ Info.Count = 0;
+ Info.MaxCount = ACPI_UINT32_MAX;
+
+ /* Search all nodes in namespace */
+
+ (void) AcpiWalkNamespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT, ACPI_UINT32_MAX,
+ AcpiDbWalkForExecute, NULL, (void *) &Info, NULL);
+
+ AcpiOsPrintf ("Evaluated %u predefined names in the namespace\n", Info.Count);
+}
diff --git a/src/acpica/source/components/disassembler/dmresrcl2.c b/src/acpica/source/components/disassembler/dmresrcl2.c
index 54276cd..8671fa6 100644
--- a/src/acpica/source/components/disassembler/dmresrcl2.c
+++ b/src/acpica/source/components/disassembler/dmresrcl2.c
@@ -586,7 +586,7 @@ AcpiDmI2cSerialBusDescriptor (
ResourceSourceOffset = sizeof (AML_RESOURCE_COMMON_SERIALBUS) +
Resource->CommonSerialBus.TypeDataLength;
- DeviceName = ACPI_ADD_PTR (char, Resource, ResourceSourceOffset),
+ DeviceName = ACPI_ADD_PTR (char, Resource, ResourceSourceOffset);
AcpiUtPrintString (DeviceName, ACPI_UINT16_MAX);
/* ResourceSourceIndex, ResourceUsage */
@@ -669,7 +669,7 @@ AcpiDmSpiSerialBusDescriptor (
ResourceSourceOffset = sizeof (AML_RESOURCE_COMMON_SERIALBUS) +
Resource->CommonSerialBus.TypeDataLength;
- DeviceName = ACPI_ADD_PTR (char, Resource, ResourceSourceOffset),
+ DeviceName = ACPI_ADD_PTR (char, Resource, ResourceSourceOffset);
AcpiUtPrintString (DeviceName, ACPI_UINT16_MAX);
/* ResourceSourceIndex, ResourceUsage */
@@ -755,7 +755,7 @@ AcpiDmUartSerialBusDescriptor (
ResourceSourceOffset = sizeof (AML_RESOURCE_COMMON_SERIALBUS) +
Resource->CommonSerialBus.TypeDataLength;
- DeviceName = ACPI_ADD_PTR (char, Resource, ResourceSourceOffset),
+ DeviceName = ACPI_ADD_PTR (char, Resource, ResourceSourceOffset);
AcpiUtPrintString (DeviceName, ACPI_UINT16_MAX);
/* ResourceSourceIndex, ResourceUsage */
diff --git a/src/acpica/source/components/dispatcher/dsmethod.c b/src/acpica/source/components/dispatcher/dsmethod.c
index f2c980e..b60b51f 100644
--- a/src/acpica/source/components/dispatcher/dsmethod.c
+++ b/src/acpica/source/components/dispatcher/dsmethod.c
@@ -179,12 +179,15 @@ AcpiDsAutoSerializeMethod (
"Method auto-serialization parse [%4.4s] %p\n",
AcpiUtGetNodeName (Node), Node));
+ AcpiExEnterInterpreter ();
+
/* Create/Init a root op for the method parse tree */
Op = AcpiPsAllocOp (AML_METHOD_OP, ObjDesc->Method.AmlStart);
if (!Op)
{
- return_ACPI_STATUS (AE_NO_MEMORY);
+ Status = AE_NO_MEMORY;
+ goto Unlock;
}
AcpiPsSetName (Op, Node->Name.Integer);
@@ -196,7 +199,8 @@ AcpiDsAutoSerializeMethod (
if (!WalkState)
{
AcpiPsFreeOp (Op);
- return_ACPI_STATUS (AE_NO_MEMORY);
+ Status = AE_NO_MEMORY;
+ goto Unlock;
}
Status = AcpiDsInitAmlWalk (WalkState, Op, Node,
@@ -215,6 +219,8 @@ AcpiDsAutoSerializeMethod (
Status = AcpiPsParseAml (WalkState);
AcpiPsDeleteParseTree (Op);
+Unlock:
+ AcpiExExitInterpreter ();
return_ACPI_STATUS (Status);
}
@@ -882,7 +888,9 @@ AcpiDsTerminateControlMethod (
{
/* Delete any direct children of (created by) this method */
+ (void) AcpiExExitInterpreter ();
AcpiNsDeleteNamespaceSubtree (WalkState->MethodNode);
+ (void) AcpiExEnterInterpreter ();
/*
* Delete any objects that were created by this method
@@ -893,7 +901,9 @@ AcpiDsTerminateControlMethod (
*/
if (MethodDesc->Method.InfoFlags & ACPI_METHOD_MODIFIED_NAMESPACE)
{
+ (void) AcpiExExitInterpreter ();
AcpiNsDeleteNamespaceByOwner (MethodDesc->Method.OwnerId);
+ (void) AcpiExEnterInterpreter ();
MethodDesc->Method.InfoFlags &=
~ACPI_METHOD_MODIFIED_NAMESPACE;
}
diff --git a/src/acpica/source/components/dispatcher/dswexec.c b/src/acpica/source/components/dispatcher/dswexec.c
index 5cedfa8..053d22a 100644
--- a/src/acpica/source/components/dispatcher/dswexec.c
+++ b/src/acpica/source/components/dispatcher/dswexec.c
@@ -216,7 +216,8 @@ AcpiDsGetPredicateValue (
* Result of predicate evaluation must be an Integer
* object. Implicitly convert the argument if necessary.
*/
- Status = AcpiExConvertToInteger (ObjDesc, &LocalObjDesc, 16);
+ Status = AcpiExConvertToInteger (ObjDesc, &LocalObjDesc,
+ ACPI_STRTOUL_BASE16);
if (ACPI_FAILURE (Status))
{
goto Cleanup;
diff --git a/src/acpica/source/components/dispatcher/dswload2.c b/src/acpica/source/components/dispatcher/dswload2.c
index fa164c8..2497406 100644
--- a/src/acpica/source/components/dispatcher/dswload2.c
+++ b/src/acpica/source/components/dispatcher/dswload2.c
@@ -696,16 +696,12 @@ AcpiDsLoad2EndOp (
{
return_ACPI_STATUS (Status);
}
-
- AcpiExExitInterpreter ();
}
+ AcpiExExitInterpreter ();
Status = AcpiEvInitializeRegion (
AcpiNsGetAttachedObject (Node), FALSE);
- if (WalkState->MethodNode)
- {
- AcpiExEnterInterpreter ();
- }
+ AcpiExEnterInterpreter ();
if (ACPI_FAILURE (Status))
{
diff --git a/src/acpica/source/components/events/evgpe.c b/src/acpica/source/components/events/evgpe.c
index 9adedb8..c37b997 100644
--- a/src/acpica/source/components/events/evgpe.c
+++ b/src/acpica/source/components/events/evgpe.c
@@ -221,6 +221,70 @@ AcpiEvEnableGpe (
/*******************************************************************************
*
+ * FUNCTION: AcpiEvMaskGpe
+ *
+ * PARAMETERS: GpeEventInfo - GPE to be blocked/unblocked
+ * IsMasked - Whether the GPE is masked or not
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Unconditionally mask/unmask a GPE during runtime.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiEvMaskGpe (
+ ACPI_GPE_EVENT_INFO *GpeEventInfo,
+ BOOLEAN IsMasked)
+{
+ ACPI_GPE_REGISTER_INFO *GpeRegisterInfo;
+ UINT32 RegisterBit;
+
+
+ ACPI_FUNCTION_TRACE (EvMaskGpe);
+
+
+ GpeRegisterInfo = GpeEventInfo->RegisterInfo;
+ if (!GpeRegisterInfo)
+ {
+ return_ACPI_STATUS (AE_NOT_EXIST);
+ }
+
+ RegisterBit = AcpiHwGetGpeRegisterBit (GpeEventInfo);
+
+ /* Perform the action */
+
+ if (IsMasked)
+ {
+ if (RegisterBit & GpeRegisterInfo->MaskForRun)
+ {
+ return_ACPI_STATUS (AE_BAD_PARAMETER);
+ }
+
+ (void) AcpiHwLowSetGpe (GpeEventInfo, ACPI_GPE_DISABLE);
+ ACPI_SET_BIT (GpeRegisterInfo->MaskForRun, (UINT8) RegisterBit);
+ }
+ else
+ {
+ if (!(RegisterBit & GpeRegisterInfo->MaskForRun))
+ {
+ return_ACPI_STATUS (AE_BAD_PARAMETER);
+ }
+
+ ACPI_CLEAR_BIT (GpeRegisterInfo->MaskForRun, (UINT8) RegisterBit);
+ if (GpeEventInfo->RuntimeCount &&
+ !GpeEventInfo->DisableForDispatch)
+ {
+ (void) AcpiHwLowSetGpe (GpeEventInfo, ACPI_GPE_ENABLE);
+ }
+ }
+
+ return_ACPI_STATUS (AE_OK);
+}
+
+
+/*******************************************************************************
+ *
* FUNCTION: AcpiEvAddGpeReference
*
* PARAMETERS: GpeEventInfo - Add a reference to this GPE
@@ -787,6 +851,7 @@ AcpiEvFinishGpe (
* in the EventInfo.
*/
(void) AcpiHwLowSetGpe (GpeEventInfo, ACPI_GPE_CONDITIONAL_ENABLE);
+ GpeEventInfo->DisableForDispatch = FALSE;
return (AE_OK);
}
@@ -856,6 +921,8 @@ AcpiEvGpeDispatch (
}
}
+ GpeEventInfo->DisableForDispatch = TRUE;
+
/*
* Dispatch the GPE to either an installed handler or the control
* method associated with this GPE (_Lxx or _Exx). If a handler
diff --git a/src/acpica/source/components/events/evgpeinit.c b/src/acpica/source/components/events/evgpeinit.c
index 2ad4785..48795d3 100644
--- a/src/acpica/source/components/events/evgpeinit.c
+++ b/src/acpica/source/components/events/evgpeinit.c
@@ -408,7 +408,9 @@ AcpiEvMatchGpeMethod (
ACPI_NAMESPACE_NODE *MethodNode = ACPI_CAST_PTR (ACPI_NAMESPACE_NODE, ObjHandle);
ACPI_GPE_WALK_INFO *WalkInfo = ACPI_CAST_PTR (ACPI_GPE_WALK_INFO, Context);
ACPI_GPE_EVENT_INFO *GpeEventInfo;
+ ACPI_STATUS Status;
UINT32 GpeNumber;
+ UINT8 TempGpeNumber;
char Name[ACPI_NAME_SIZE + 1];
UINT8 Type;
@@ -467,8 +469,8 @@ AcpiEvMatchGpeMethod (
/* 4) The last two characters of the name are the hex GPE Number */
- GpeNumber = strtoul (&Name[2], NULL, 16);
- if (GpeNumber == ACPI_UINT32_MAX)
+ Status = AcpiUtAsciiToHexByte (&Name[2], &TempGpeNumber);
+ if (ACPI_FAILURE (Status))
{
/* Conversion failed; invalid method, just ignore it */
@@ -480,6 +482,7 @@ AcpiEvMatchGpeMethod (
/* Ensure that we have a valid GPE number for this GPE block */
+ GpeNumber = (UINT32) TempGpeNumber;
GpeEventInfo = AcpiEvLowGetGpeInfo (GpeNumber, WalkInfo->GpeBlock);
if (!GpeEventInfo)
{
diff --git a/src/acpica/source/components/events/evrgnini.c b/src/acpica/source/components/events/evrgnini.c
index 7880d04..2e6315c 100644
--- a/src/acpica/source/components/events/evrgnini.c
+++ b/src/acpica/source/components/events/evrgnini.c
@@ -690,7 +690,8 @@ AcpiEvInitializeRegion (
*
* See AcpiNsExecModuleCode
*/
- if (ObjDesc->Method.InfoFlags & ACPI_METHOD_MODULE_LEVEL)
+ if (!AcpiGbl_ParseTableAsTermList &&
+ ObjDesc->Method.InfoFlags & ACPI_METHOD_MODULE_LEVEL)
{
HandlerObj = ObjDesc->Method.Dispatch.Handler;
}
diff --git a/src/acpica/source/components/events/evxfgpe.c b/src/acpica/source/components/events/evxfgpe.c
index 2d5afd6..0c86647 100644
--- a/src/acpica/source/components/events/evxfgpe.c
+++ b/src/acpica/source/components/events/evxfgpe.c
@@ -343,11 +343,13 @@ AcpiSetGpe (
case ACPI_GPE_ENABLE:
Status = AcpiHwLowSetGpe (GpeEventInfo, ACPI_GPE_ENABLE);
+ GpeEventInfo->DisableForDispatch = FALSE;
break;
case ACPI_GPE_DISABLE:
Status = AcpiHwLowSetGpe (GpeEventInfo, ACPI_GPE_DISABLE);
+ GpeEventInfo->DisableForDispatch = TRUE;
break;
default:
@@ -366,6 +368,56 @@ ACPI_EXPORT_SYMBOL (AcpiSetGpe)
/*******************************************************************************
*
+ * FUNCTION: AcpiMaskGpe
+ *
+ * PARAMETERS: GpeDevice - Parent GPE Device. NULL for GPE0/GPE1
+ * GpeNumber - GPE level within the GPE block
+ * IsMasked - Whether the GPE is masked or not
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Unconditionally mask/unmask the an individual GPE, ex., to
+ * prevent a GPE flooding.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiMaskGpe (
+ ACPI_HANDLE GpeDevice,
+ UINT32 GpeNumber,
+ BOOLEAN IsMasked)
+{
+ ACPI_GPE_EVENT_INFO *GpeEventInfo;
+ ACPI_STATUS Status;
+ ACPI_CPU_FLAGS Flags;
+
+
+ ACPI_FUNCTION_TRACE (AcpiMaskGpe);
+
+
+ Flags = AcpiOsAcquireLock (AcpiGbl_GpeLock);
+
+ /* Ensure that we have a valid GPE number */
+
+ GpeEventInfo = AcpiEvGetGpeEventInfo (GpeDevice, GpeNumber);
+ if (!GpeEventInfo)
+ {
+ Status = AE_BAD_PARAMETER;
+ goto UnlockAndExit;
+ }
+
+ Status = AcpiEvMaskGpe (GpeEventInfo, IsMasked);
+
+UnlockAndExit:
+ AcpiOsReleaseLock (AcpiGbl_GpeLock, Flags);
+ return_ACPI_STATUS (Status);
+}
+
+ACPI_EXPORT_SYMBOL (AcpiMaskGpe)
+
+
+/*******************************************************************************
+ *
* FUNCTION: AcpiMarkGpeForWake
*
* PARAMETERS: GpeDevice - Parent GPE Device. NULL for GPE0/GPE1
diff --git a/src/acpica/source/components/executer/exconcat.c b/src/acpica/source/components/executer/exconcat.c
index db9f71c..8cd8316 100644
--- a/src/acpica/source/components/executer/exconcat.c
+++ b/src/acpica/source/components/executer/exconcat.c
@@ -237,7 +237,8 @@ AcpiExDoConcatenate (
{
case ACPI_TYPE_INTEGER:
- Status = AcpiExConvertToInteger (LocalOperand1, &TempOperand1, 16);
+ Status = AcpiExConvertToInteger (LocalOperand1, &TempOperand1,
+ ACPI_STRTOUL_BASE16);
break;
case ACPI_TYPE_BUFFER:
diff --git a/src/acpica/source/components/executer/exconfig.c b/src/acpica/source/components/executer/exconfig.c
index 333567f..5223434 100644
--- a/src/acpica/source/components/executer/exconfig.c
+++ b/src/acpica/source/components/executer/exconfig.c
@@ -132,7 +132,6 @@
static ACPI_STATUS
AcpiExAddTable (
UINT32 TableIndex,
- ACPI_NAMESPACE_NODE *ParentNode,
ACPI_OPERAND_OBJECT **DdbHandle);
static ACPI_STATUS
@@ -160,12 +159,9 @@ AcpiExRegionRead (
static ACPI_STATUS
AcpiExAddTable (
UINT32 TableIndex,
- ACPI_NAMESPACE_NODE *ParentNode,
ACPI_OPERAND_OBJECT **DdbHandle)
{
ACPI_OPERAND_OBJECT *ObjDesc;
- ACPI_STATUS Status;
- ACPI_OWNER_ID OwnerId;
ACPI_FUNCTION_TRACE (ExAddTable);
@@ -183,42 +179,8 @@ AcpiExAddTable (
ObjDesc->Common.Flags |= AOPOBJ_DATA_VALID;
ObjDesc->Reference.Class = ACPI_REFCLASS_TABLE;
- *DdbHandle = ObjDesc;
-
- /* Install the new table into the local data structures */
-
ObjDesc->Reference.Value = TableIndex;
-
- /* Add the table to the namespace */
-
- Status = AcpiNsLoadTable (TableIndex, ParentNode);
- if (ACPI_FAILURE (Status))
- {
- AcpiUtRemoveReference (ObjDesc);
- *DdbHandle = NULL;
- return_ACPI_STATUS (Status);
- }
-
- /* Execute any module-level code that was found in the table */
-
- AcpiExExitInterpreter ();
- if (AcpiGbl_GroupModuleLevelCode)
- {
- AcpiNsExecModuleCodeList ();
- }
- AcpiExEnterInterpreter ();
-
- /*
- * Update GPEs for any new _Lxx/_Exx methods. Ignore errors. The host is
- * responsible for discovering any new wake GPEs by running _PRW methods
- * that may have been loaded by this table.
- */
- Status = AcpiTbGetOwnerId (TableIndex, &OwnerId);
- if (ACPI_SUCCESS (Status))
- {
- AcpiEvUpdateGpes (OwnerId);
- }
-
+ *DdbHandle = ObjDesc;
return_ACPI_STATUS (AE_OK);
}
@@ -247,7 +209,6 @@ AcpiExLoadTableOp (
ACPI_NAMESPACE_NODE *StartNode;
ACPI_NAMESPACE_NODE *ParameterNode = NULL;
ACPI_OPERAND_OBJECT *DdbHandle;
- ACPI_TABLE_HEADER *Table;
UINT32 TableIndex;
@@ -256,10 +217,12 @@ AcpiExLoadTableOp (
/* Find the ACPI table in the RSDT/XSDT */
+ AcpiExExitInterpreter ();
Status = AcpiTbFindTable (
Operand[0]->String.Pointer,
Operand[1]->String.Pointer,
Operand[2]->String.Pointer, &TableIndex);
+ AcpiExEnterInterpreter ();
if (ACPI_FAILURE (Status))
{
if (Status != AE_NOT_FOUND)
@@ -292,8 +255,9 @@ AcpiExLoadTableOp (
* Find the node referenced by the RootPathString. This is the
* location within the namespace where the table will be loaded.
*/
- Status = AcpiNsGetNode (StartNode, Operand[3]->String.Pointer,
- ACPI_NS_SEARCH_PARENT, &ParentNode);
+ Status = AcpiNsGetNodeUnlocked (StartNode,
+ Operand[3]->String.Pointer, ACPI_NS_SEARCH_PARENT,
+ &ParentNode);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
@@ -316,8 +280,9 @@ AcpiExLoadTableOp (
/* Find the node referenced by the ParameterPathString */
- Status = AcpiNsGetNode (StartNode, Operand[4]->String.Pointer,
- ACPI_NS_SEARCH_PARENT, &ParameterNode);
+ Status = AcpiNsGetNodeUnlocked (StartNode,
+ Operand[4]->String.Pointer, ACPI_NS_SEARCH_PARENT,
+ &ParameterNode);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
@@ -326,7 +291,16 @@ AcpiExLoadTableOp (
/* Load the table into the namespace */
- Status = AcpiExAddTable (TableIndex, ParentNode, &DdbHandle);
+ ACPI_INFO (("Dynamic OEM Table Load:"));
+ AcpiExExitInterpreter ();
+ Status = AcpiTbLoadTable (TableIndex, ParentNode);
+ AcpiExEnterInterpreter ();
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+
+ Status = AcpiExAddTable (TableIndex, &DdbHandle);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
@@ -349,21 +323,6 @@ AcpiExLoadTableOp (
}
}
- Status = AcpiGetTableByIndex (TableIndex, &Table);
- if (ACPI_SUCCESS (Status))
- {
- ACPI_INFO (("Dynamic OEM Table Load:"));
- AcpiTbPrintTableHeader (0, Table);
- }
-
- /* Invoke table handler if present */
-
- if (AcpiGbl_TableHandler)
- {
- (void) AcpiGbl_TableHandler (ACPI_TABLE_EVENT_LOAD, Table,
- AcpiGbl_TableHandlerContext);
- }
-
*ReturnDesc = DdbHandle;
return_ACPI_STATUS (Status);
}
@@ -593,13 +552,10 @@ AcpiExLoadOp (
/* Install the new table into the local data structures */
ACPI_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);
-
- (void) AcpiUtReleaseMutex (ACPI_MTX_TABLES);
+ AcpiExExitInterpreter ();
+ Status = AcpiTbInstallAndLoadTable (Table, ACPI_PTR_TO_PHYSADDR (Table),
+ ACPI_TABLE_ORIGIN_INTERNAL_VIRTUAL, TRUE, &TableIndex);
+ AcpiExEnterInterpreter ();
if (ACPI_FAILURE (Status))
{
/* Delete allocated table buffer */
@@ -609,24 +565,13 @@ AcpiExLoadOp (
}
/*
- * Note: Now table is "INSTALLED", it must be validated before
- * loading.
- */
- Status = AcpiTbValidateTable (
- &AcpiGbl_RootTableList.Tables[TableIndex]);
- if (ACPI_FAILURE (Status))
- {
- return_ACPI_STATUS (Status);
- }
-
- /*
* Add the table to the namespace.
*
* Note: Load the table objects relative to the root of the namespace.
* This appears to go against the ACPI specification, but we do it for
* compatibility with other ACPI implementations.
*/
- Status = AcpiExAddTable (TableIndex, AcpiGbl_RootNode, &DdbHandle);
+ Status = AcpiExAddTable (TableIndex, &DdbHandle);
if (ACPI_FAILURE (Status))
{
/* On error, TablePtr was deallocated above */
@@ -650,15 +595,6 @@ AcpiExLoadOp (
/* Remove the reference by added by AcpiExStore above */
AcpiUtRemoveReference (DdbHandle);
-
- /* Invoke table handler if present */
-
- if (AcpiGbl_TableHandler)
- {
- (void) AcpiGbl_TableHandler (ACPI_TABLE_EVENT_LOAD, Table,
- AcpiGbl_TableHandlerContext);
- }
-
return_ACPI_STATUS (Status);
}
diff --git a/src/acpica/source/components/executer/exconvrt.c b/src/acpica/source/components/executer/exconvrt.c
index 4a83d61..d01657a 100644
--- a/src/acpica/source/components/executer/exconvrt.c
+++ b/src/acpica/source/components/executer/exconvrt.c
@@ -209,8 +209,8 @@ AcpiExConvertToInteger (
* of ACPI 3.0) is that the ToInteger() operator allows both decimal
* and hexadecimal strings (hex prefixed with "0x").
*/
- Status = AcpiUtStrtoul64 ((char *) Pointer, Flags,
- AcpiGbl_IntegerByteWidth, &Result);
+ Status = AcpiUtStrtoul64 (ACPI_CAST_PTR (char, Pointer),
+ (AcpiGbl_IntegerByteWidth | Flags), &Result);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
@@ -756,7 +756,8 @@ AcpiExConvertToTargetType (
* These types require an Integer operand. We can convert
* a Buffer or a String to an Integer if necessary.
*/
- Status = AcpiExConvertToInteger (SourceDesc, ResultDesc, 16);
+ Status = AcpiExConvertToInteger (SourceDesc, ResultDesc,
+ ACPI_STRTOUL_BASE16);
break;
case ACPI_TYPE_STRING:
diff --git a/src/acpica/source/components/executer/exmisc.c b/src/acpica/source/components/executer/exmisc.c
index 559decc..813eb05 100644
--- a/src/acpica/source/components/executer/exmisc.c
+++ b/src/acpica/source/components/executer/exmisc.c
@@ -433,7 +433,8 @@ AcpiExDoLogicalOp (
{
case ACPI_TYPE_INTEGER:
- Status = AcpiExConvertToInteger (Operand1, &LocalOperand1, 16);
+ Status = AcpiExConvertToInteger (Operand1, &LocalOperand1,
+ ACPI_STRTOUL_BASE16);
break;
case ACPI_TYPE_STRING:
diff --git a/src/acpica/source/components/executer/exoparg1.c b/src/acpica/source/components/executer/exoparg1.c
index ad53d7e..1f89af5 100644
--- a/src/acpica/source/components/executer/exoparg1.c
+++ b/src/acpica/source/components/executer/exoparg1.c
@@ -622,8 +622,9 @@ AcpiExOpcode_1A_1T_1R (
case AML_TO_INTEGER_OP: /* ToInteger (Data, Result) */
- Status = AcpiExConvertToInteger (
- Operand[0], &ReturnDesc, ACPI_ANY_BASE);
+ /* Perform "explicit" conversion */
+
+ Status = AcpiExConvertToInteger (Operand[0], &ReturnDesc, 0);
if (ReturnDesc == Operand[0])
{
/* No conversion performed, add ref to handle return value */
@@ -1008,7 +1009,7 @@ AcpiExOpcode_1A_0T_1R (
* 2) Dereference the node to an actual object. Could be a
* Field, so we need to resolve the node to a value.
*/
- Status = AcpiNsGetNode (WalkState->ScopeInfo->Scope.Node,
+ Status = AcpiNsGetNodeUnlocked (WalkState->ScopeInfo->Scope.Node,
Operand[0]->String.Pointer,
ACPI_NS_SEARCH_PARENT,
ACPI_CAST_INDIRECT_PTR (
diff --git a/src/acpica/source/components/executer/exresop.c b/src/acpica/source/components/executer/exresop.c
index 1616920..eacd130 100644
--- a/src/acpica/source/components/executer/exresop.c
+++ b/src/acpica/source/components/executer/exresop.c
@@ -500,11 +500,13 @@ AcpiExResolveOperands (
case ARGI_INTEGER:
/*
- * Need an operand of type ACPI_TYPE_INTEGER,
- * But we can implicitly convert from a STRING or BUFFER
- * Aka - "Implicit Source Operand Conversion"
+ * Need an operand of type ACPI_TYPE_INTEGER, but we can
+ * implicitly convert from a STRING or BUFFER.
+ *
+ * Known as "Implicit Source Operand Conversion"
*/
- Status = AcpiExConvertToInteger (ObjDesc, StackPtr, 16);
+ Status = AcpiExConvertToInteger (ObjDesc, StackPtr,
+ ACPI_STRTOUL_BASE16);
if (ACPI_FAILURE (Status))
{
if (Status == AE_TYPE)
diff --git a/src/acpica/source/components/executer/extrace.c b/src/acpica/source/components/executer/extrace.c
index ca9653c..5f11851 100644
--- a/src/acpica/source/components/executer/extrace.c
+++ b/src/acpica/source/components/executer/extrace.c
@@ -298,7 +298,6 @@ AcpiExStartTraceMethod (
ACPI_OPERAND_OBJECT *ObjDesc,
ACPI_WALK_STATE *WalkState)
{
- ACPI_STATUS Status;
char *Pathname = NULL;
BOOLEAN Enabled = FALSE;
@@ -311,12 +310,6 @@ AcpiExStartTraceMethod (
Pathname = AcpiNsGetNormalizedPathname (MethodNode, TRUE);
}
- Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE);
- if (ACPI_FAILURE (Status))
- {
- goto Exit;
- }
-
Enabled = AcpiExInterpreterTraceEnabled (Pathname);
if (Enabled && !AcpiGbl_TraceMethodObject)
{
@@ -337,9 +330,6 @@ AcpiExStartTraceMethod (
}
}
- (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
-
-Exit:
if (Enabled)
{
ACPI_TRACE_POINT (ACPI_TRACE_AML_METHOD, TRUE,
@@ -374,7 +364,6 @@ AcpiExStopTraceMethod (
ACPI_OPERAND_OBJECT *ObjDesc,
ACPI_WALK_STATE *WalkState)
{
- ACPI_STATUS Status;
char *Pathname = NULL;
BOOLEAN Enabled;
@@ -387,28 +376,14 @@ AcpiExStopTraceMethod (
Pathname = AcpiNsGetNormalizedPathname (MethodNode, TRUE);
}
- Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE);
- if (ACPI_FAILURE (Status))
- {
- goto ExitPath;
- }
-
Enabled = AcpiExInterpreterTraceEnabled (NULL);
- (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
-
if (Enabled)
{
ACPI_TRACE_POINT (ACPI_TRACE_AML_METHOD, FALSE,
ObjDesc ? ObjDesc->Method.AmlStart : NULL, Pathname);
}
- Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE);
- if (ACPI_FAILURE (Status))
- {
- goto ExitPath;
- }
-
/* Check whether the tracer should be stopped */
if (AcpiGbl_TraceMethodObject == ObjDesc)
@@ -425,9 +400,6 @@ AcpiExStopTraceMethod (
AcpiGbl_TraceMethodObject = NULL;
}
- (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
-
-ExitPath:
if (Pathname)
{
ACPI_FREE (Pathname);
diff --git a/src/acpica/source/components/executer/exutils.c b/src/acpica/source/components/executer/exutils.c
index ec22f84..59c77e7 100644
--- a/src/acpica/source/components/executer/exutils.c
+++ b/src/acpica/source/components/executer/exutils.c
@@ -175,6 +175,11 @@ AcpiExEnterInterpreter (
{
ACPI_ERROR ((AE_INFO, "Could not acquire AML Interpreter mutex"));
}
+ Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE);
+ if (ACPI_FAILURE (Status))
+ {
+ ACPI_ERROR ((AE_INFO, "Could not acquire AML Namespace mutex"));
+ }
return_VOID;
}
@@ -213,6 +218,11 @@ AcpiExExitInterpreter (
ACPI_FUNCTION_TRACE (ExExitInterpreter);
+ Status = AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
+ if (ACPI_FAILURE (Status))
+ {
+ ACPI_ERROR ((AE_INFO, "Could not release AML Namespace mutex"));
+ }
Status = AcpiUtReleaseMutex (ACPI_MTX_INTERPRETER);
if (ACPI_FAILURE (Status))
{
diff --git a/src/acpica/source/components/hardware/hwgpe.c b/src/acpica/source/components/hardware/hwgpe.c
index db250b9..1e26339 100644
--- a/src/acpica/source/components/hardware/hwgpe.c
+++ b/src/acpica/source/components/hardware/hwgpe.c
@@ -180,7 +180,7 @@ AcpiHwLowSetGpe (
UINT32 Action)
{
ACPI_GPE_REGISTER_INFO *GpeRegisterInfo;
- ACPI_STATUS Status;
+ ACPI_STATUS Status = AE_OK;
UINT32 EnableMask;
UINT32 RegisterBit;
@@ -236,9 +236,12 @@ AcpiHwLowSetGpe (
return (AE_BAD_PARAMETER);
}
- /* Write the updated enable mask */
+ if (!(RegisterBit & GpeRegisterInfo->MaskForRun))
+ {
+ /* Write the updated enable mask */
- Status = AcpiHwWrite (EnableMask, &GpeRegisterInfo->EnableAddress);
+ Status = AcpiHwWrite (EnableMask, &GpeRegisterInfo->EnableAddress);
+ }
return (Status);
}
@@ -341,6 +344,13 @@ AcpiHwGetGpeStatus (
LocalEventStatus |= ACPI_EVENT_FLAG_ENABLED;
}
+ /* GPE currently masked? (masked for runtime?) */
+
+ if (RegisterBit & GpeRegisterInfo->MaskForRun)
+ {
+ LocalEventStatus |= ACPI_EVENT_FLAG_MASKED;
+ }
+
/* GPE enabled for wake? */
if (RegisterBit & GpeRegisterInfo->EnableForWake)
@@ -512,6 +522,7 @@ AcpiHwEnableRuntimeGpeBlock (
UINT32 i;
ACPI_STATUS Status;
ACPI_GPE_REGISTER_INFO *GpeRegisterInfo;
+ UINT8 EnableMask;
/* NOTE: assumes that all GPEs are currently disabled */
@@ -528,8 +539,9 @@ AcpiHwEnableRuntimeGpeBlock (
/* Enable all "runtime" GPEs in this register */
- Status = AcpiHwGpeEnableWrite (GpeRegisterInfo->EnableForRun,
- GpeRegisterInfo);
+ EnableMask = GpeRegisterInfo->EnableForRun &
+ ~GpeRegisterInfo->MaskForRun;
+ Status = AcpiHwGpeEnableWrite (EnableMask, GpeRegisterInfo);
if (ACPI_FAILURE (Status))
{
return (Status);
diff --git a/src/acpica/source/components/namespace/nsconvert.c b/src/acpica/source/components/namespace/nsconvert.c
index ef321e7..5913778 100644
--- a/src/acpica/source/components/namespace/nsconvert.c
+++ b/src/acpica/source/components/namespace/nsconvert.c
@@ -156,7 +156,7 @@ AcpiNsConvertToInteger (
/* String-to-Integer conversion */
Status = AcpiUtStrtoul64 (OriginalObject->String.Pointer,
- ACPI_ANY_BASE, AcpiGbl_IntegerByteWidth, &Value);
+ AcpiGbl_IntegerByteWidth, &Value);
if (ACPI_FAILURE (Status))
{
return (Status);
diff --git a/src/acpica/source/components/namespace/nsload.c b/src/acpica/source/components/namespace/nsload.c
index c3869aa..f34c48e 100644
--- a/src/acpica/source/components/namespace/nsload.c
+++ b/src/acpica/source/components/namespace/nsload.c
@@ -118,6 +118,7 @@
#include "acnamesp.h"
#include "acdispat.h"
#include "actables.h"
+#include "acinterp.h"
#define _COMPONENT ACPI_NAMESPACE
@@ -161,21 +162,6 @@ AcpiNsLoadTable (
ACPI_FUNCTION_TRACE (NsLoadTable);
- /*
- * Parse the table and load the namespace with all named
- * objects found within. Control methods are NOT parsed
- * at this time. In fact, the control methods cannot be
- * parsed until the entire namespace is loaded, because
- * if a control method makes a forward reference (call)
- * to another control method, we can't continue parsing
- * because we don't know how many arguments to parse next!
- */
- Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE);
- if (ACPI_FAILURE (Status))
- {
- return_ACPI_STATUS (Status);
- }
-
/* If table already loaded into namespace, just return */
if (AcpiTbIsTableLoaded (TableIndex))
@@ -193,6 +179,15 @@ AcpiNsLoadTable (
goto Unlock;
}
+ /*
+ * Parse the table and load the namespace with all named
+ * objects found within. Control methods are NOT parsed
+ * at this time. In fact, the control methods cannot be
+ * parsed until the entire namespace is loaded, because
+ * if a control method makes a forward reference (call)
+ * to another control method, we can't continue parsing
+ * because we don't know how many arguments to parse next!
+ */
Status = AcpiNsParseTable (TableIndex, Node);
if (ACPI_SUCCESS (Status))
{
@@ -209,7 +204,6 @@ AcpiNsLoadTable (
* exist. This target of Scope must already exist in the
* namespace, as per the ACPI specification.
*/
- (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
AcpiNsDeleteNamespaceByOwner (
AcpiGbl_RootTableList.Tables[TableIndex].OwnerId);
@@ -218,8 +212,6 @@ AcpiNsLoadTable (
}
Unlock:
- (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
-
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
@@ -252,7 +244,7 @@ Unlock:
* other ACPI implementations. Optionally, the execution can be deferred
* until later, see AcpiInitializeObjects.
*/
- if (!AcpiGbl_GroupModuleLevelCode)
+ if (!AcpiGbl_ParseTableAsTermList && !AcpiGbl_GroupModuleLevelCode)
{
AcpiNsExecModuleCodeList ();
}
diff --git a/src/acpica/source/components/namespace/nsparse.c b/src/acpica/source/components/namespace/nsparse.c
index 6cfdd06..cedd77d 100644
--- a/src/acpica/source/components/namespace/nsparse.c
+++ b/src/acpica/source/components/namespace/nsparse.c
@@ -119,6 +119,7 @@
#include "acparser.h"
#include "acdispat.h"
#include "actables.h"
+#include "acinterp.h"
#define _COMPONENT ACPI_NAMESPACE
@@ -127,6 +128,109 @@
/*******************************************************************************
*
+ * FUNCTION: NsExecuteTable
+ *
+ * PARAMETERS: TableDesc - An ACPI table descriptor for table to parse
+ * StartNode - Where to enter the table into the namespace
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Load ACPI/AML table by executing the entire table as a
+ * TermList.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiNsExecuteTable (
+ UINT32 TableIndex,
+ ACPI_NAMESPACE_NODE *StartNode)
+{
+ ACPI_STATUS Status;
+ ACPI_TABLE_HEADER *Table;
+ ACPI_OWNER_ID OwnerId;
+ ACPI_EVALUATE_INFO *Info = NULL;
+ UINT32 AmlLength;
+ UINT8 *AmlStart;
+ ACPI_OPERAND_OBJECT *MethodObj = NULL;
+
+
+ ACPI_FUNCTION_TRACE (NsExecuteTable);
+
+
+ Status = AcpiGetTableByIndex (TableIndex, &Table);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+
+ /* Table must consist of at least a complete header */
+
+ if (Table->Length < sizeof (ACPI_TABLE_HEADER))
+ {
+ return_ACPI_STATUS (AE_BAD_HEADER);
+ }
+
+ AmlStart = (UINT8 *) Table + sizeof (ACPI_TABLE_HEADER);
+ AmlLength = Table->Length - sizeof (ACPI_TABLE_HEADER);
+
+ Status = AcpiTbGetOwnerId (TableIndex, &OwnerId);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+
+ /* Create, initialize, and link a new temporary method object */
+
+ MethodObj = AcpiUtCreateInternalObject (ACPI_TYPE_METHOD);
+ if (!MethodObj)
+ {
+ return_ACPI_STATUS (AE_NO_MEMORY);
+ }
+
+ /* Allocate the evaluation information block */
+
+ Info = ACPI_ALLOCATE_ZEROED (sizeof (ACPI_EVALUATE_INFO));
+ if (!Info)
+ {
+ Status = AE_NO_MEMORY;
+ goto Cleanup;
+ }
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_PARSE,
+ "Create table code block: %p\n", MethodObj));
+
+ MethodObj->Method.AmlStart = AmlStart;
+ MethodObj->Method.AmlLength = AmlLength;
+ MethodObj->Method.OwnerId = OwnerId;
+ MethodObj->Method.InfoFlags |= ACPI_METHOD_MODULE_LEVEL;
+
+ Info->PassNumber = ACPI_IMODE_EXECUTE;
+ Info->Node = StartNode;
+ Info->ObjDesc = MethodObj;
+ Info->NodeFlags = Info->Node->Flags;
+ Info->FullPathname = AcpiNsGetNormalizedPathname (Info->Node, TRUE);
+ if (!Info->FullPathname)
+ {
+ Status = AE_NO_MEMORY;
+ goto Cleanup;
+ }
+
+ Status = AcpiPsExecuteTable (Info);
+
+Cleanup:
+ if (Info)
+ {
+ ACPI_FREE (Info->FullPathname);
+ Info->FullPathname = NULL;
+ }
+ ACPI_FREE (Info);
+ AcpiUtRemoveReference (MethodObj);
+ return_ACPI_STATUS (Status);
+}
+
+
+/*******************************************************************************
+ *
* FUNCTION: NsOneCompleteParse
*
* PARAMETERS: PassNumber - 1 or 2
@@ -228,7 +332,9 @@ AcpiNsOneCompleteParse (
ACPI_DEBUG_PRINT ((ACPI_DB_PARSE,
"*PARSE* pass %u parse\n", PassNumber));
+ AcpiExEnterInterpreter ();
Status = AcpiPsParseAml (WalkState);
+ AcpiExExitInterpreter ();
Cleanup:
AcpiPsDeleteParseTree (ParseRoot);
@@ -260,40 +366,53 @@ AcpiNsParseTable (
ACPI_FUNCTION_TRACE (NsParseTable);
- /*
- * AML Parse, pass 1
- *
- * In this pass, we load most of the namespace. Control methods
- * are not parsed until later. A parse tree is not created. Instead,
- * each Parser Op subtree is deleted when it is finished. This saves
- * a great deal of memory, and allows a small cache of parse objects
- * to service the entire parse. The second pass of the parse then
- * performs another complete parse of the AML.
- */
- ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "**** Start pass 1\n"));
-
- Status = AcpiNsOneCompleteParse (ACPI_IMODE_LOAD_PASS1,
- TableIndex, StartNode);
- if (ACPI_FAILURE (Status))
+ if (AcpiGbl_ParseTableAsTermList)
{
- return_ACPI_STATUS (Status);
- }
+ ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "**** Start load pass\n"));
- /*
- * AML Parse, pass 2
- *
- * In this pass, we resolve forward references and other things
- * that could not be completed during the first pass.
- * Another complete parse of the AML is performed, but the
- * overhead of this is compensated for by the fact that the
- * parse objects are all cached.
- */
- ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "**** Start pass 2\n"));
- Status = AcpiNsOneCompleteParse (ACPI_IMODE_LOAD_PASS2,
- TableIndex, StartNode);
- if (ACPI_FAILURE (Status))
+ Status = AcpiNsExecuteTable (TableIndex, StartNode);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+ }
+ else
{
- return_ACPI_STATUS (Status);
+ /*
+ * AML Parse, pass 1
+ *
+ * In this pass, we load most of the namespace. Control methods
+ * are not parsed until later. A parse tree is not created.
+ * Instead, each Parser Op subtree is deleted when it is finished.
+ * This saves a great deal of memory, and allows a small cache of
+ * parse objects to service the entire parse. The second pass of
+ * the parse then performs another complete parse of the AML.
+ */
+ ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "**** Start pass 1\n"));
+
+ Status = AcpiNsOneCompleteParse (ACPI_IMODE_LOAD_PASS1,
+ TableIndex, StartNode);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+
+ /*
+ * AML Parse, pass 2
+ *
+ * In this pass, we resolve forward references and other things
+ * that could not be completed during the first pass.
+ * Another complete parse of the AML is performed, but the
+ * overhead of this is compensated for by the fact that the
+ * parse objects are all cached.
+ */
+ ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "**** Start pass 2\n"));
+ Status = AcpiNsOneCompleteParse (ACPI_IMODE_LOAD_PASS2,
+ TableIndex, StartNode);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
}
return_ACPI_STATUS (Status);
diff --git a/src/acpica/source/components/namespace/nsutils.c b/src/acpica/source/components/namespace/nsutils.c
index 4784497..cdffc0a 100644
--- a/src/acpica/source/components/namespace/nsutils.c
+++ b/src/acpica/source/components/namespace/nsutils.c
@@ -843,7 +843,7 @@ AcpiNsOpensScope (
/*******************************************************************************
*
- * FUNCTION: AcpiNsGetNode
+ * FUNCTION: AcpiNsGetNodeUnlocked
*
* PARAMETERS: *Pathname - Name to be found, in external (ASL) format. The
* \ (backslash) and ^ (carat) prefixes, and the
@@ -859,12 +859,12 @@ AcpiNsOpensScope (
* DESCRIPTION: Look up a name relative to a given scope and return the
* corresponding Node. NOTE: Scope can be null.
*
- * MUTEX: Locks namespace
+ * MUTEX: Doesn't locks namespace
*
******************************************************************************/
ACPI_STATUS
-AcpiNsGetNode (
+AcpiNsGetNodeUnlocked (
ACPI_NAMESPACE_NODE *PrefixNode,
const char *Pathname,
UINT32 Flags,
@@ -875,7 +875,7 @@ AcpiNsGetNode (
char *InternalPath;
- ACPI_FUNCTION_TRACE_PTR (NsGetNode, ACPI_CAST_PTR (char, Pathname));
+ ACPI_FUNCTION_TRACE_PTR (NsGetNodeUnlocked, ACPI_CAST_PTR (char, Pathname));
/* Simplest case is a null pathname */
@@ -907,14 +907,6 @@ AcpiNsGetNode (
return_ACPI_STATUS (Status);
}
- /* Must lock namespace during lookup */
-
- Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE);
- if (ACPI_FAILURE (Status))
- {
- goto Cleanup;
- }
-
/* Setup lookup scope (search starting point) */
ScopeInfo.Scope.Node = PrefixNode;
@@ -930,9 +922,55 @@ AcpiNsGetNode (
Pathname, AcpiFormatException (Status)));
}
- (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
-
-Cleanup:
ACPI_FREE (InternalPath);
return_ACPI_STATUS (Status);
}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiNsGetNode
+ *
+ * PARAMETERS: *Pathname - Name to be found, in external (ASL) format. The
+ * \ (backslash) and ^ (carat) prefixes, and the
+ * . (period) to separate segments are supported.
+ * PrefixNode - Root of subtree to be searched, or NS_ALL for the
+ * root of the name space. If Name is fully
+ * qualified (first INT8 is '\'), the passed value
+ * of Scope will not be accessed.
+ * Flags - Used to indicate whether to perform upsearch or
+ * not.
+ * ReturnNode - Where the Node is returned
+ *
+ * DESCRIPTION: Look up a name relative to a given scope and return the
+ * corresponding Node. NOTE: Scope can be null.
+ *
+ * MUTEX: Locks namespace
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiNsGetNode (
+ ACPI_NAMESPACE_NODE *PrefixNode,
+ const char *Pathname,
+ UINT32 Flags,
+ ACPI_NAMESPACE_NODE **ReturnNode)
+{
+ ACPI_STATUS Status;
+
+
+ ACPI_FUNCTION_TRACE_PTR (NsGetNode, ACPI_CAST_PTR (char, Pathname));
+
+
+ Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+
+ Status = AcpiNsGetNodeUnlocked (PrefixNode, Pathname,
+ Flags, ReturnNode);
+
+ (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
+ return_ACPI_STATUS (Status);
+}
diff --git a/src/acpica/source/components/parser/psparse.c b/src/acpica/source/components/parser/psparse.c
index 68281bd..1f49ce4 100644
--- a/src/acpica/source/components/parser/psparse.c
+++ b/src/acpica/source/components/parser/psparse.c
@@ -627,8 +627,10 @@ AcpiPsParseAml (
{
/* Either the method parse or actual execution failed */
+ AcpiExExitInterpreter ();
ACPI_ERROR_METHOD ("Method parse/execution failed",
WalkState->MethodNode, NULL, Status);
+ AcpiExEnterInterpreter ();
/* Check for possible multi-thread reentrancy problem */
@@ -661,7 +663,8 @@ AcpiPsParseAml (
* cleanup to do
*/
if (((WalkState->ParseFlags & ACPI_PARSE_MODE_MASK) ==
- ACPI_PARSE_EXECUTE) ||
+ ACPI_PARSE_EXECUTE &&
+ !(WalkState->ParseFlags & ACPI_PARSE_MODULE_LEVEL)) ||
(ACPI_FAILURE (Status)))
{
AcpiDsTerminateControlMethod (WalkState->MethodDesc, WalkState);
diff --git a/src/acpica/source/components/parser/psxface.c b/src/acpica/source/components/parser/psxface.c
index 5c690a4..71b880d 100644
--- a/src/acpica/source/components/parser/psxface.c
+++ b/src/acpica/source/components/parser/psxface.c
@@ -347,6 +347,88 @@ Cleanup:
/*******************************************************************************
*
+ * FUNCTION: AcpiPsExecuteTable
+ *
+ * PARAMETERS: Info - Method info block, contains:
+ * Node - Node to where the is entered into the
+ * namespace
+ * ObjDesc - Pseudo method object describing the AML
+ * code of the entire table
+ * PassNumber - Parse or execute pass
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Execute a table
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiPsExecuteTable (
+ ACPI_EVALUATE_INFO *Info)
+{
+ ACPI_STATUS Status;
+ ACPI_PARSE_OBJECT *Op = NULL;
+ ACPI_WALK_STATE *WalkState = NULL;
+
+
+ ACPI_FUNCTION_TRACE (PsExecuteTable);
+
+
+ /* Create and init a Root Node */
+
+ Op = AcpiPsCreateScopeOp (Info->ObjDesc->Method.AmlStart);
+ if (!Op)
+ {
+ Status = AE_NO_MEMORY;
+ goto Cleanup;
+ }
+
+ /* Create and initialize a new walk state */
+
+ WalkState = AcpiDsCreateWalkState (
+ Info->ObjDesc->Method.OwnerId, NULL, NULL, NULL);
+ if (!WalkState)
+ {
+ Status = AE_NO_MEMORY;
+ goto Cleanup;
+ }
+
+ Status = AcpiDsInitAmlWalk (WalkState, Op, Info->Node,
+ Info->ObjDesc->Method.AmlStart,
+ Info->ObjDesc->Method.AmlLength, Info, Info->PassNumber);
+ if (ACPI_FAILURE (Status))
+ {
+ goto Cleanup;
+ }
+
+ if (Info->ObjDesc->Method.InfoFlags & ACPI_METHOD_MODULE_LEVEL)
+ {
+ WalkState->ParseFlags |= ACPI_PARSE_MODULE_LEVEL;
+ }
+
+ /*
+ * Parse the AML, WalkState will be deleted by ParseAml
+ */
+ AcpiExEnterInterpreter ();
+ Status = AcpiPsParseAml (WalkState);
+ AcpiExExitInterpreter ();
+ WalkState = NULL;
+
+Cleanup:
+ if (WalkState)
+ {
+ AcpiDsDeleteWalkState (WalkState);
+ }
+ if (Op)
+ {
+ AcpiPsDeleteParseTree (Op);
+ }
+ return_ACPI_STATUS (Status);
+}
+
+
+/*******************************************************************************
+ *
* FUNCTION: AcpiPsUpdateParameterList
*
* PARAMETERS: Info - See ACPI_EVALUATE_INFO
diff --git a/src/acpica/source/components/tables/tbdata.c b/src/acpica/source/components/tables/tbdata.c
index 9cb9015..0bddeef 100644
--- a/src/acpica/source/components/tables/tbdata.c
+++ b/src/acpica/source/components/tables/tbdata.c
@@ -117,6 +117,7 @@
#include "accommon.h"
#include "acnamesp.h"
#include "actables.h"
+#include "acevents.h"
#define _COMPONENT ACPI_TABLES
ACPI_MODULE_NAME ("tbdata")
@@ -939,3 +940,160 @@ AcpiTbSetTableLoadedFlag (
(void) AcpiUtReleaseMutex (ACPI_MTX_TABLES);
}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiTbLoadTable
+ *
+ * PARAMETERS: TableIndex - Table index
+ * ParentNode - Where table index is returned
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Load an ACPI table
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiTbLoadTable (
+ UINT32 TableIndex,
+ ACPI_NAMESPACE_NODE *ParentNode)
+{
+ ACPI_TABLE_HEADER *Table;
+ ACPI_STATUS Status;
+ ACPI_OWNER_ID OwnerId;
+
+
+ ACPI_FUNCTION_TRACE (TbLoadTable);
+
+
+ /*
+ * Note: Now table is "INSTALLED", it must be validated before
+ * using.
+ */
+ Status = AcpiGetTableByIndex (TableIndex, &Table);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+
+ Status = AcpiNsLoadTable (TableIndex, ParentNode);
+
+ /* Execute any module-level code that was found in the table */
+
+ if (!AcpiGbl_ParseTableAsTermList && AcpiGbl_GroupModuleLevelCode)
+ {
+ AcpiNsExecModuleCodeList ();
+ }
+
+ /*
+ * Update GPEs for any new _Lxx/_Exx methods. Ignore errors. The host is
+ * responsible for discovering any new wake GPEs by running _PRW methods
+ * that may have been loaded by this table.
+ */
+ Status = AcpiTbGetOwnerId (TableIndex, &OwnerId);
+ if (ACPI_SUCCESS (Status))
+ {
+ AcpiEvUpdateGpes (OwnerId);
+ }
+
+ /* Invoke table handler if present */
+
+ if (AcpiGbl_TableHandler)
+ {
+ (void) AcpiGbl_TableHandler (ACPI_TABLE_EVENT_LOAD, Table,
+ AcpiGbl_TableHandlerContext);
+ }
+
+ return_ACPI_STATUS (Status);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiTbInstallAndLoadTable
+ *
+ * PARAMETERS: Table - Pointer to the table
+ * Address - Physical address of the table
+ * Flags - Allocation flags of the table
+ * TableIndex - Where table index is returned
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Install and load an ACPI table
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiTbInstallAndLoadTable (
+ ACPI_TABLE_HEADER *Table,
+ ACPI_PHYSICAL_ADDRESS Address,
+ UINT8 Flags,
+ BOOLEAN Override,
+ UINT32 *TableIndex)
+{
+ ACPI_STATUS Status;
+ UINT32 i;
+ ACPI_OWNER_ID OwnerId;
+
+
+ ACPI_FUNCTION_TRACE (AcpiLoadTable);
+
+
+ (void) AcpiUtAcquireMutex (ACPI_MTX_TABLES);
+
+ /* Install the table and load it into the namespace */
+
+ Status = AcpiTbInstallStandardTable (Address, Flags, TRUE,
+ Override, &i);
+ if (ACPI_FAILURE (Status))
+ {
+ goto UnlockAndExit;
+ }
+
+ /*
+ * Note: Now table is "INSTALLED", it must be validated before
+ * using.
+ */
+ Status = AcpiTbValidateTable (&AcpiGbl_RootTableList.Tables[i]);
+ if (ACPI_FAILURE (Status))
+ {
+ goto UnlockAndExit;
+ }
+
+ (void) AcpiUtReleaseMutex (ACPI_MTX_TABLES);
+ Status = AcpiNsLoadTable (i, AcpiGbl_RootNode);
+
+ /* Execute any module-level code that was found in the table */
+
+ if (!AcpiGbl_ParseTableAsTermList && AcpiGbl_GroupModuleLevelCode)
+ {
+ AcpiNsExecModuleCodeList ();
+ }
+
+ /*
+ * Update GPEs for any new _Lxx/_Exx methods. Ignore errors. The host is
+ * responsible for discovering any new wake GPEs by running _PRW methods
+ * that may have been loaded by this table.
+ */
+ Status = AcpiTbGetOwnerId (i, &OwnerId);
+ if (ACPI_SUCCESS (Status))
+ {
+ AcpiEvUpdateGpes (OwnerId);
+ }
+
+ /* Invoke table handler if present */
+
+ if (AcpiGbl_TableHandler)
+ {
+ (void) AcpiGbl_TableHandler (ACPI_TABLE_EVENT_LOAD, Table,
+ AcpiGbl_TableHandlerContext);
+ }
+ (void) AcpiUtAcquireMutex (ACPI_MTX_TABLES);
+
+UnlockAndExit:
+ *TableIndex = i;
+ (void) AcpiUtReleaseMutex (ACPI_MTX_TABLES);
+ return_ACPI_STATUS (Status);
+}
diff --git a/src/acpica/source/components/tables/tbfadt.c b/src/acpica/source/components/tables/tbfadt.c
index 6fb738d..89c6c0e 100644
--- a/src/acpica/source/components/tables/tbfadt.c
+++ b/src/acpica/source/components/tables/tbfadt.c
@@ -447,8 +447,10 @@ AcpiTbParseFadt (
/* Obtain the DSDT and FACS tables via their addresses within the FADT */
- AcpiTbInstallFixedTable ((ACPI_PHYSICAL_ADDRESS) AcpiGbl_FADT.XDsdt,
- ACPI_SIG_DSDT, &AcpiGbl_DsdtIndex);
+ AcpiTbInstallStandardTable (
+ (ACPI_PHYSICAL_ADDRESS) AcpiGbl_FADT.XDsdt,
+ ACPI_TABLE_ORIGIN_INTERNAL_PHYSICAL, FALSE, TRUE,
+ &AcpiGbl_DsdtIndex);
/* If Hardware Reduced flag is set, there is no FACS */
@@ -456,13 +458,17 @@ AcpiTbParseFadt (
{
if (AcpiGbl_FADT.Facs)
{
- AcpiTbInstallFixedTable ((ACPI_PHYSICAL_ADDRESS) AcpiGbl_FADT.Facs,
- ACPI_SIG_FACS, &AcpiGbl_FacsIndex);
+ AcpiTbInstallStandardTable (
+ (ACPI_PHYSICAL_ADDRESS) AcpiGbl_FADT.Facs,
+ ACPI_TABLE_ORIGIN_INTERNAL_PHYSICAL, FALSE, TRUE,
+ &AcpiGbl_FacsIndex);
}
if (AcpiGbl_FADT.XFacs)
{
- AcpiTbInstallFixedTable ((ACPI_PHYSICAL_ADDRESS) AcpiGbl_FADT.XFacs,
- ACPI_SIG_FACS, &AcpiGbl_XFacsIndex);
+ AcpiTbInstallStandardTable (
+ (ACPI_PHYSICAL_ADDRESS) AcpiGbl_FADT.XFacs,
+ ACPI_TABLE_ORIGIN_INTERNAL_PHYSICAL, FALSE, TRUE,
+ &AcpiGbl_XFacsIndex);
}
}
}
@@ -665,65 +671,67 @@ AcpiTbConvertFadt (
*
* Address32 zero, Address64 [don't care] - Use Address64
*
+ * No override: if AcpiGbl_Use32BitFadtAddresses is FALSE, and:
* Address32 non-zero, Address64 zero - Copy/use Address32
* Address32 non-zero == Address64 non-zero - Use Address64
* Address32 non-zero != Address64 non-zero - Warning, use Address64
*
* Override: if AcpiGbl_Use32BitFadtAddresses is TRUE, and:
+ * Address32 non-zero, Address64 zero - Copy/use Address32
+ * Address32 non-zero == Address64 non-zero - Copy/use Address32
* Address32 non-zero != Address64 non-zero - Warning, copy/use Address32
*
* Note: SpaceId is always I/O for 32-bit legacy address fields
*/
if (Address32)
{
- if (!Address64->Address)
- {
- /* 64-bit address is zero, use 32-bit address */
-
- AcpiTbInitGenericAddress (Address64,
- ACPI_ADR_SPACE_SYSTEM_IO,
- *ACPI_ADD_PTR (UINT8, &AcpiGbl_FADT,
- FadtInfoTable[i].Length),
- (UINT64) Address32, Name, Flags);
- }
- else if (Address64->Address != (UINT64) Address32)
+ if (Address64->Address)
{
- /* Address mismatch */
-
- ACPI_BIOS_WARNING ((AE_INFO,
- "32/64X address mismatch in FADT/%s: "
- "0x%8.8X/0x%8.8X%8.8X, using %u-bit address",
- Name, Address32,
- ACPI_FORMAT_UINT64 (Address64->Address),
- AcpiGbl_Use32BitFadtAddresses ? 32 : 64));
-
- if (AcpiGbl_Use32BitFadtAddresses)
+ if (Address64->Address != (UINT64) Address32)
{
- /* 32-bit address override */
+ /* Address mismatch */
+
+ ACPI_BIOS_WARNING ((AE_INFO,
+ "32/64X address mismatch in FADT/%s: "
+ "0x%8.8X/0x%8.8X%8.8X, using %u-bit address",
+ Name, Address32,
+ ACPI_FORMAT_UINT64 (Address64->Address),
+ AcpiGbl_Use32BitFadtAddresses ? 32 : 64));
+ }
- AcpiTbInitGenericAddress (Address64,
- ACPI_ADR_SPACE_SYSTEM_IO,
- *ACPI_ADD_PTR (UINT8, &AcpiGbl_FADT,
- FadtInfoTable[i].Length),
- (UINT64) Address32, Name, Flags);
+ /*
+ * For each extended field, check for length mismatch
+ * between the legacy length field and the corresponding
+ * 64-bit X length field.
+ * Note: If the legacy length field is > 0xFF bits, ignore
+ * this check. (GPE registers can be larger than the
+ * 64-bit GAS structure can accomodate, 0xFF bits).
+ */
+ if ((ACPI_MUL_8 (Length) <= ACPI_UINT8_MAX) &&
+ (Address64->BitWidth != ACPI_MUL_8 (Length)))
+ {
+ ACPI_BIOS_WARNING ((AE_INFO,
+ "32/64X length mismatch in FADT/%s: %u/%u",
+ Name, ACPI_MUL_8 (Length), Address64->BitWidth));
}
}
- }
- /*
- * For each extended field, check for length mismatch between the
- * legacy length field and the corresponding 64-bit X length field.
- * Note: If the legacy length field is > 0xFF bits, ignore this
- * check. (GPE registers can be larger than the 64-bit GAS structure
- * can accomodate, 0xFF bits).
- */
- if (Address64->Address &&
- (ACPI_MUL_8 (Length) <= ACPI_UINT8_MAX) &&
- (Address64->BitWidth != ACPI_MUL_8 (Length)))
- {
- ACPI_BIOS_WARNING ((AE_INFO,
- "32/64X length mismatch in FADT/%s: %u/%u",
- Name, ACPI_MUL_8 (Length), Address64->BitWidth));
+ /*
+ * Hardware register access code always uses the 64-bit fields.
+ * So if the 64-bit field is zero or is to be overridden,
+ * initialize it with the 32-bit fields.
+ * Note that when the 32-bit address favor is specified, the
+ * 64-bit fields are always re-initialized so that
+ * AccessSize/BitWidth/BitOffset fields can be correctly
+ * configured to the values to trigger a 32-bit compatible
+ * access mode in the hardware register access code.
+ */
+ if (!Address64->Address || AcpiGbl_Use32BitFadtAddresses)
+ {
+ AcpiTbInitGenericAddress (Address64,
+ ACPI_ADR_SPACE_SYSTEM_IO, Length,
+ (UINT64) Address32, Name, Flags);
+ }
}
if (FadtInfoTable[i].Flags & ACPI_FADT_REQUIRED)
diff --git a/src/acpica/source/components/tables/tbfind.c b/src/acpica/source/components/tables/tbfind.c
index bd68aaf..d688c42 100644
--- a/src/acpica/source/components/tables/tbfind.c
+++ b/src/acpica/source/components/tables/tbfind.c
@@ -145,7 +145,7 @@ AcpiTbFindTable (
char *OemTableId,
UINT32 *TableIndex)
{
- ACPI_STATUS Status;
+ ACPI_STATUS Status = AE_OK;
ACPI_TABLE_HEADER Header;
UINT32 i;
@@ -177,6 +177,7 @@ AcpiTbFindTable (
/* Search for the table */
+ (void) AcpiUtAcquireMutex (ACPI_MTX_TABLES);
for (i = 0; i < AcpiGbl_RootTableList.CurrentTableCount; ++i)
{
if (memcmp (&(AcpiGbl_RootTableList.Tables[i].Signature),
@@ -196,7 +197,7 @@ AcpiTbFindTable (
Status = AcpiTbValidateTable (&AcpiGbl_RootTableList.Tables[i]);
if (ACPI_FAILURE (Status))
{
- return_ACPI_STATUS (Status);
+ goto UnlockAndExit;
}
if (!AcpiGbl_RootTableList.Tables[i].Pointer)
@@ -220,9 +221,12 @@ AcpiTbFindTable (
ACPI_DEBUG_PRINT ((ACPI_DB_TABLES, "Found table [%4.4s]\n",
Header.Signature));
- return_ACPI_STATUS (AE_OK);
+ goto UnlockAndExit;
}
}
+ Status = AE_NOT_FOUND;
+UnlockAndExit:
+ (void) AcpiUtReleaseMutex (ACPI_MTX_TABLES);
return_ACPI_STATUS (AE_NOT_FOUND);
}
diff --git a/src/acpica/source/components/tables/tbinstal.c b/src/acpica/source/components/tables/tbinstal.c
index 6d664d6..5a29a36 100644
--- a/src/acpica/source/components/tables/tbinstal.c
+++ b/src/acpica/source/components/tables/tbinstal.c
@@ -241,74 +241,6 @@ AcpiTbInstallTableWithOverride (
/*******************************************************************************
*
- * FUNCTION: AcpiTbInstallFixedTable
- *
- * PARAMETERS: Address - Physical address of DSDT or FACS
- * Signature - Table signature, NULL if no need to
- * match
- * TableIndex - Where the table index is returned
- *
- * RETURN: Status
- *
- * DESCRIPTION: Install a fixed ACPI table (DSDT/FACS) into the global data
- * structure.
- *
- ******************************************************************************/
-
-ACPI_STATUS
-AcpiTbInstallFixedTable (
- ACPI_PHYSICAL_ADDRESS Address,
- char *Signature,
- UINT32 *TableIndex)
-{
- ACPI_TABLE_DESC NewTableDesc;
- ACPI_STATUS Status;
-
-
- ACPI_FUNCTION_TRACE (TbInstallFixedTable);
-
-
- if (!Address)
- {
- ACPI_ERROR ((AE_INFO, "Null physical address for ACPI table [%s]",
- Signature));
- return (AE_NO_MEMORY);
- }
-
- /* Fill a table descriptor for validation */
-
- Status = AcpiTbAcquireTempTable (&NewTableDesc, Address,
- ACPI_TABLE_ORIGIN_INTERNAL_PHYSICAL);
- if (ACPI_FAILURE (Status))
- {
- ACPI_ERROR ((AE_INFO, "Could not acquire table length at %8.8X%8.8X",
- ACPI_FORMAT_UINT64 (Address)));
- return_ACPI_STATUS (Status);
- }
-
- /* Validate and verify a table before installation */
-
- Status = AcpiTbVerifyTempTable (&NewTableDesc, Signature);
- if (ACPI_FAILURE (Status))
- {
- goto ReleaseAndExit;
- }
-
- /* Add the table to the global root table list */
-
- AcpiTbInstallTableWithOverride (&NewTableDesc, TRUE, TableIndex);
-
-ReleaseAndExit:
-
- /* Release the temporary table descriptor */
-
- AcpiTbReleaseTempTable (&NewTableDesc);
- return_ACPI_STATUS (Status);
-}
-
-
-/*******************************************************************************
- *
* FUNCTION: AcpiTbInstallStandardTable
*
* PARAMETERS: Address - Address of the table (might be a virtual
@@ -320,8 +252,7 @@ ReleaseAndExit:
*
* RETURN: Status
*
- * DESCRIPTION: This function is called to install an ACPI table that is
- * neither DSDT nor FACS (a "standard" table.)
+ * DESCRIPTION: This function is called to verify and install an ACPI 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
@@ -462,6 +393,14 @@ AcpiTbInstallStandardTable (
AcpiTbInstallTableWithOverride (&NewTableDesc, Override, TableIndex);
+ /* Invoke table handler if present */
+
+ if (AcpiGbl_TableHandler)
+ {
+ (void) AcpiGbl_TableHandler (ACPI_TABLE_EVENT_INSTALL,
+ NewTableDesc.Pointer, AcpiGbl_TableHandlerContext);
+ }
+
ReleaseAndExit:
/* Release the temporary table descriptor */
diff --git a/src/acpica/source/components/tables/tbxfload.c b/src/acpica/source/components/tables/tbxfload.c
index 6ffc3cc..6a937b1 100644
--- a/src/acpica/source/components/tables/tbxfload.c
+++ b/src/acpica/source/components/tables/tbxfload.c
@@ -183,7 +183,7 @@ AcpiLoadTables (
"While loading namespace from ACPI tables"));
}
- if (!AcpiGbl_GroupModuleLevelCode)
+ if (AcpiGbl_ParseTableAsTermList || !AcpiGbl_GroupModuleLevelCode)
{
/*
* Initialize the objects that remain uninitialized. This
@@ -279,11 +279,11 @@ AcpiTbLoadNamespace (
memcpy (&AcpiGbl_OriginalDsdtHeader, AcpiGbl_DSDT,
sizeof (ACPI_TABLE_HEADER));
- (void) AcpiUtReleaseMutex (ACPI_MTX_TABLES);
-
/* Load and parse tables */
+ (void) AcpiUtReleaseMutex (ACPI_MTX_TABLES);
Status = AcpiNsLoadTable (AcpiGbl_DsdtIndex, AcpiGbl_RootNode);
+ (void) AcpiUtAcquireMutex (ACPI_MTX_TABLES);
if (ACPI_FAILURE (Status))
{
ACPI_EXCEPTION ((AE_INFO, Status, "[DSDT] table load failed"));
@@ -296,7 +296,6 @@ AcpiTbLoadNamespace (
/* Load any SSDT or PSDT tables. Note: Loop leaves tables locked */
- (void) AcpiUtAcquireMutex (ACPI_MTX_TABLES);
for (i = 0; i < AcpiGbl_RootTableList.CurrentTableCount; ++i)
{
Table = &AcpiGbl_RootTableList.Tables[i];
@@ -314,6 +313,7 @@ AcpiTbLoadNamespace (
(void) AcpiUtReleaseMutex (ACPI_MTX_TABLES);
Status = AcpiNsLoadTable (i, AcpiGbl_RootNode);
+ (void) AcpiUtAcquireMutex (ACPI_MTX_TABLES);
if (ACPI_FAILURE (Status))
{
ACPI_EXCEPTION ((AE_INFO, Status, "(%4.4s:%8.8s) while loading table",
@@ -329,8 +329,6 @@ AcpiTbLoadNamespace (
{
TablesLoaded++;
}
-
- (void) AcpiUtAcquireMutex (ACPI_MTX_TABLES);
}
if (!TablesFailed)
@@ -438,52 +436,11 @@ AcpiLoadTable (
return_ACPI_STATUS (AE_BAD_PARAMETER);
}
- /* Must acquire the interpreter lock during this operation */
-
- Status = AcpiUtAcquireMutex (ACPI_MTX_INTERPRETER);
- if (ACPI_FAILURE (Status))
- {
- return_ACPI_STATUS (Status);
- }
-
/* Install the table and load it into the namespace */
ACPI_INFO (("Host-directed Dynamic ACPI Table Load:"));
- (void) AcpiUtAcquireMutex (ACPI_MTX_TABLES);
-
- Status = AcpiTbInstallStandardTable (ACPI_PTR_TO_PHYSADDR (Table),
- ACPI_TABLE_ORIGIN_EXTERNAL_VIRTUAL, TRUE, FALSE,
- &TableIndex);
-
- (void) AcpiUtReleaseMutex (ACPI_MTX_TABLES);
- if (ACPI_FAILURE (Status))
- {
- goto UnlockAndExit;
- }
-
- /*
- * Note: Now table is "INSTALLED", it must be validated before
- * using.
- */
- Status = AcpiTbValidateTable (
- &AcpiGbl_RootTableList.Tables[TableIndex]);
- if (ACPI_FAILURE (Status))
- {
- goto UnlockAndExit;
- }
-
- Status = AcpiNsLoadTable (TableIndex, AcpiGbl_RootNode);
-
- /* Invoke table handler if present */
-
- if (AcpiGbl_TableHandler)
- {
- (void) AcpiGbl_TableHandler (ACPI_TABLE_EVENT_LOAD, Table,
- AcpiGbl_TableHandlerContext);
- }
-
-UnlockAndExit:
- (void) AcpiUtReleaseMutex (ACPI_MTX_INTERPRETER);
+ Status = AcpiTbInstallAndLoadTable (Table, ACPI_PTR_TO_PHYSADDR (Table),
+ ACPI_TABLE_ORIGIN_EXTERNAL_VIRTUAL, FALSE, &TableIndex);
return_ACPI_STATUS (Status);
}
diff --git a/src/acpica/source/components/utilities/utaddress.c b/src/acpica/source/components/utilities/utaddress.c
index 3fc1b63..4c0c98d 100644
--- a/src/acpica/source/components/utilities/utaddress.c
+++ b/src/acpica/source/components/utilities/utaddress.c
@@ -154,7 +154,6 @@ AcpiUtAddAddressRange (
ACPI_NAMESPACE_NODE *RegionNode)
{
ACPI_ADDRESS_RANGE *RangeInfo;
- ACPI_STATUS Status;
ACPI_FUNCTION_TRACE (UtAddAddressRange);
@@ -178,13 +177,6 @@ AcpiUtAddAddressRange (
RangeInfo->EndAddress = (Address + Length - 1);
RangeInfo->RegionNode = RegionNode;
- Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE);
- if (ACPI_FAILURE (Status))
- {
- ACPI_FREE (RangeInfo);
- return_ACPI_STATUS (Status);
- }
-
RangeInfo->Next = AcpiGbl_AddressRangeList[SpaceId];
AcpiGbl_AddressRangeList[SpaceId] = RangeInfo;
@@ -194,7 +186,6 @@ AcpiUtAddAddressRange (
ACPI_FORMAT_UINT64 (Address),
ACPI_FORMAT_UINT64 (RangeInfo->EndAddress)));
- (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
return_ACPI_STATUS (AE_OK);
}
diff --git a/src/acpica/source/components/utilities/uthex.c b/src/acpica/source/components/utilities/uthex.c
index 2bbdc01..9a37816 100644
--- a/src/acpica/source/components/utilities/uthex.c
+++ b/src/acpica/source/components/utilities/uthex.c
@@ -154,9 +154,46 @@ AcpiUtHexToAsciiChar (
/*******************************************************************************
*
+ * 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
*
@@ -169,15 +206,21 @@ AcpiUtAsciiCharToHex (
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 --git a/src/acpica/source/components/utilities/utnonansi.c b/src/acpica/source/components/utilities/utnonansi.c
index 1e6512e..e7dbd0b 100644
--- a/src/acpica/source/components/utilities/utnonansi.c
+++ b/src/acpica/source/components/utilities/utnonansi.c
@@ -120,10 +120,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.
*/
/*******************************************************************************
@@ -310,430 +309,3 @@ AcpiUtSafeStrncat (
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;
- }
- else
- {
- break;
- }
- }
-
- ReturnValue *= Base;
- ReturnValue += ThisDigit;
- String++;
- }
-
- /* All done, normal exit */
-
-AllDone:
-
- ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Converted value: %8.8X%8.8X\n",
- ACPI_FORMAT_UINT64 (ReturnValue)));
-
- *RetInteger = ReturnValue;
- return_ACPI_STATUS (AE_OK);
-
-
-ErrorExit:
-
- /* Base was set/validated above (10 or 16) */
-
- if (Base == 10)
- {
- return_ACPI_STATUS (AE_BAD_DECIMAL_CONSTANT);
- }
- else
- {
- return_ACPI_STATUS (AE_BAD_HEX_CONSTANT);
- }
-}
-
-
-#ifdef _OBSOLETE_FUNCTIONS
-/* Removed: 01/2016 */
-
-/*******************************************************************************
- *
- * FUNCTION: strtoul64
- *
- * PARAMETERS: String - Null terminated string
- * Terminater - Where a pointer to the terminating byte
- * is returned
- * Base - Radix of the string
- *
- * RETURN: Converted value
- *
- * DESCRIPTION: Convert a string into an unsigned value.
- *
- ******************************************************************************/
-
-ACPI_STATUS
-strtoul64 (
- char *String,
- UINT32 Base,
- UINT64 *RetInteger)
-{
- UINT32 Index;
- UINT32 Sign;
- UINT64 ReturnValue = 0;
- ACPI_STATUS Status = AE_OK;
-
-
- *RetInteger = 0;
-
- switch (Base)
- {
- case 0:
- case 8:
- case 10:
- case 16:
-
- break;
-
- default:
- /*
- * The specified Base parameter is not in the domain of
- * this function:
- */
- return (AE_BAD_PARAMETER);
- }
-
- /* Skip over any white space in the buffer: */
-
- while (isspace ((int) *String) || *String == '\t')
- {
- ++String;
- }
-
- /*
- * The buffer may contain an optional plus or minus sign.
- * If it does, then skip over it but remember what is was:
- */
- if (*String == '-')
- {
- Sign = ACPI_SIGN_NEGATIVE;
- ++String;
- }
- else if (*String == '+')
- {
- ++String;
- Sign = ACPI_SIGN_POSITIVE;
- }
- else
- {
- Sign = ACPI_SIGN_POSITIVE;
- }
-
- /*
- * If the input parameter Base is zero, then we need to
- * determine if it is octal, decimal, or hexadecimal:
- */
- if (Base == 0)
- {
- if (*String == '0')
- {
- if (tolower ((int) *(++String)) == 'x')
- {
- Base = 16;
- ++String;
- }
- else
- {
- Base = 8;
- }
- }
- else
- {
- Base = 10;
- }
- }
-
- /*
- * For octal and hexadecimal bases, skip over the leading
- * 0 or 0x, if they are present.
- */
- if (Base == 8 && *String == '0')
- {
- String++;
- }
-
- if (Base == 16 &&
- *String == '0' &&
- tolower ((int) *(++String)) == 'x')
- {
- String++;
- }
-
- /* Main loop: convert the string to an unsigned long */
-
- while (*String)
- {
- if (isdigit ((int) *String))
- {
- Index = ((UINT8) *String) - '0';
- }
- else
- {
- Index = (UINT8) toupper ((int) *String);
- if (isupper ((int) Index))
- {
- Index = Index - 'A' + 10;
- }
- else
- {
- goto ErrorExit;
- }
- }
-
- if (Index >= Base)
- {
- goto ErrorExit;
- }
-
- /* Check to see if value is out of range: */
-
- if (ReturnValue > ((ACPI_UINT64_MAX - (UINT64) Index) /
- (UINT64) Base))
- {
- goto ErrorExit;
- }
- else
- {
- ReturnValue *= Base;
- ReturnValue += Index;
- }
-
- ++String;
- }
-
-
- /* If a minus sign was present, then "the conversion is negated": */
-
- if (Sign == ACPI_SIGN_NEGATIVE)
- {
- ReturnValue = (ACPI_UINT32_MAX - ReturnValue) + 1;
- }
-
- *RetInteger = ReturnValue;
- return (Status);
-
-
-ErrorExit:
- switch (Base)
- {
- case 8:
-
- Status = AE_BAD_OCTAL_CONSTANT;
- break;
-
- case 10:
-
- Status = AE_BAD_DECIMAL_CONSTANT;
- break;
-
- case 16:
-
- Status = AE_BAD_HEX_CONSTANT;
- break;
-
- default:
-
- /* Base validated above */
-
- break;
- }
-
- return (Status);
-}
-#endif
diff --git a/src/acpica/source/components/utilities/utosi.c b/src/acpica/source/components/utilities/utosi.c
index bf645da..4dcd3f4 100644
--- a/src/acpica/source/components/utilities/utosi.c
+++ b/src/acpica/source/components/utilities/utosi.c
@@ -514,11 +514,22 @@ AcpiUtGetInterface (
* PARAMETERS: WalkState - Current walk state
*
* RETURN: Status
+ * Integer: TRUE (0) if input string is matched
+ * FALSE (-1) if string is not matched
*
* DESCRIPTION: Implementation of the _OSI predefined control method. When
* an invocation of _OSI is encountered in the system AML,
* control is transferred to this function.
*
+ * (August 2016)
+ * Note: _OSI is now defined to return "Ones" to indicate a match, for
+ * compatibility with other ACPI implementations. On a 32-bit DSDT, Ones
+ * is 0xFFFFFFFF. On a 64-bit DSDT, Ones is 0xFFFFFFFFFFFFFFFF
+ * (ACPI_UINT64_MAX).
+ *
+ * This function always returns ACPI_UINT64_MAX for TRUE, and later code
+ * will truncate this to 32 bits if necessary.
+ *
******************************************************************************/
ACPI_STATUS
@@ -530,7 +541,7 @@ AcpiUtOsiImplementation (
ACPI_INTERFACE_INFO *InterfaceInfo;
ACPI_INTERFACE_HANDLER InterfaceHandler;
ACPI_STATUS Status;
- UINT32 ReturnValue;
+ UINT64 ReturnValue;
ACPI_FUNCTION_TRACE (UtOsiImplementation);
@@ -579,7 +590,7 @@ AcpiUtOsiImplementation (
AcpiGbl_OsiData = InterfaceInfo->Value;
}
- ReturnValue = ACPI_UINT32_MAX;
+ ReturnValue = ACPI_UINT64_MAX;
}
AcpiOsReleaseMutex (AcpiGbl_OsiMutex);
@@ -592,8 +603,11 @@ AcpiUtOsiImplementation (
InterfaceHandler = AcpiGbl_InterfaceHandler;
if (InterfaceHandler)
{
- ReturnValue = InterfaceHandler (
- StringDesc->String.Pointer, ReturnValue);
+ if (InterfaceHandler (
+ StringDesc->String.Pointer, (UINT32) ReturnValue))
+ {
+ ReturnValue = ACPI_UINT64_MAX;
+ }
}
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO,
diff --git a/src/acpica/source/components/utilities/utstrtoul64.c b/src/acpica/source/components/utilities/utstrtoul64.c
new file mode 100644
index 0000000..bdc424b
--- /dev/null
+++ b/src/acpica/source/components/utilities/utstrtoul64.c
@@ -0,0 +1,462 @@
+/*******************************************************************************
+ *
+ * Module Name: utstrtoul64 - string to 64-bit integer support
+ *
+ ******************************************************************************/
+
+/******************************************************************************
+ *
+ * 1. Copyright Notice
+ *
+ * Some or all of this work - Copyright (c) 1999 - 2016, 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"
+
+
+/*******************************************************************************
+ *
+ * The functions in this module satisfy the need for 64-bit string-to-integer
+ * conversions on both 32-bit and 64-bit platforms.
+ *
+ ******************************************************************************/
+
+#define _COMPONENT ACPI_UTILITIES
+ ACPI_MODULE_NAME ("utstrtoul64")
+
+/* Local prototypes */
+
+static UINT64
+AcpiUtStrtoulBase10 (
+ char *String,
+ UINT32 Flags);
+
+static UINT64
+AcpiUtStrtoulBase16 (
+ char *String,
+ UINT32 Flags);
+
+
+/*******************************************************************************
+ *
+ * String conversion rules as written in the ACPI specification. The error
+ * conditions and behavior are different depending on the type of conversion.
+ *
+ *
+ * Implicit data type conversion: string-to-integer
+ * --------------------------------------------------
+ *
+ * Base is always 16. This is the ACPI_STRTOUL_BASE16 case.
+ *
+ * Example:
+ * Add ("BA98", Arg0, Local0)
+ *
+ * The integer is initialized to the value zero.
+ * The ASCII string is interpreted as a hexadecimal constant.
+ *
+ * 1) A 0x prefix is not allowed. However, ACPICA allows this for
+ * compatibility with previous ACPICA. (NO ERROR)
+ *
+ * 2) Terminates when the size of an integer is reached (32 or 64 bits).
+ * (NO ERROR)
+ *
+ * 3) The first non-hex character terminates the conversion without error.
+ * (NO ERROR)
+ *
+ * 4) Conversion of a null (zero-length) string to an integer is not
+ * allowed. However, ACPICA allows this for compatibility with previous
+ * ACPICA. This conversion returns the value 0. (NO ERROR)
+ *
+ *
+ * Explicit data type conversion: ToInteger() with string operand
+ * ---------------------------------------------------------------
+ *
+ * Base is either 10 (default) or 16 (with 0x prefix)
+ *
+ * Examples:
+ * ToInteger ("1000")
+ * ToInteger ("0xABCD")
+ *
+ * 1) Can be (must be) either a decimal or hexadecimal numeric string.
+ * A hex value must be prefixed by "0x" or it is interpreted as a decimal.
+ *
+ * 2) The value must not exceed the maximum of an integer value. ACPI spec
+ * states the behavior is "unpredictable", so ACPICA matches the behavior
+ * of the implicit conversion case.(NO ERROR)
+ *
+ * 3) Behavior on the first non-hex character is not specified by the ACPI
+ * spec, so ACPICA matches the behavior of the implicit conversion case
+ * and terminates. (NO ERROR)
+ *
+ * 4) A null (zero-length) string is illegal.
+ * However, ACPICA allows this for compatibility with previous ACPICA.
+ * This conversion returns the value 0. (NO ERROR)
+ *
+ ******************************************************************************/
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiUtStrtoul64
+ *
+ * PARAMETERS: String - Null terminated input string
+ * Flags - Conversion info, see below
+ * ReturnValue - 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 in Flags (often the current mode of the interpreter).
+ *
+ * Values for Flags:
+ * ACPI_STRTOUL_32BIT - Max integer value is 32 bits
+ * ACPI_STRTOUL_64BIT - Max integer value is 64 bits
+ * ACPI_STRTOUL_BASE16 - Input string is hexadecimal. Default
+ * is 10/16 based on string prefix (0x).
+ *
+ * NOTES:
+ * Negative numbers are not supported, as they are not supported by ACPI.
+ *
+ * Supports only base 16 or base 10 strings/values. Does not
+ * support Octal strings, as these are not supported by ACPI.
+ *
+ * Current users of this support:
+ *
+ * Interpreter - Implicit and explicit conversions, GPE method names
+ * Debugger - Command line input string conversion
+ * iASL - Main parser, conversion of constants to integers
+ * iASL - Data Table Compiler parser (constant math expressions)
+ * iASL - Preprocessor (constant math expressions)
+ * AcpiDump - Input table addresses
+ * AcpiExec - Testing of the AcpiUtStrtoul64 function
+ *
+ * Note concerning callers:
+ * AcpiGbl_IntegerByteWidth can be used to set the 32/64 limit. If used,
+ * this global 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.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiUtStrtoul64 (
+ char *String,
+ UINT32 Flags,
+ UINT64 *ReturnValue)
+{
+ ACPI_STATUS Status = AE_OK;
+ UINT32 Base;
+
+
+ ACPI_FUNCTION_TRACE_STR (UtStrtoul64, String);
+
+
+ /* Parameter validation */
+
+ if (!String || !ReturnValue)
+ {
+ return_ACPI_STATUS (AE_BAD_PARAMETER);
+ }
+
+ *ReturnValue = 0;
+
+ /* Check for zero-length string, returns 0 */
+
+ if (*String == 0)
+ {
+ return_ACPI_STATUS (AE_OK);
+ }
+
+ /* Skip over any white space at start of string */
+
+ while (isspace ((int) *String))
+ {
+ String++;
+ }
+
+ /* End of string? return 0 */
+
+ if (*String == 0)
+ {
+ return_ACPI_STATUS (AE_OK);
+ }
+
+ /*
+ * 1) The "0x" prefix indicates base 16. Per the ACPI specification,
+ * the "0x" prefix is only allowed for implicit (non-strict) conversions.
+ * However, we always allow it for compatibility with older ACPICA.
+ */
+ if ((*String == ACPI_ASCII_ZERO) &&
+ (tolower ((int) *(String + 1)) == 'x'))
+ {
+ String += 2; /* Go past the 0x */
+ if (*String == 0)
+ {
+ return_ACPI_STATUS (AE_OK); /* Return value 0 */
+ }
+
+ Base = 16;
+ }
+
+ /* 2) Force to base 16 (implicit conversion case) */
+
+ else if (Flags & ACPI_STRTOUL_BASE16)
+ {
+ Base = 16;
+ }
+
+ /* 3) Default fallback is to Base 10 */
+
+ else
+ {
+ Base = 10;
+ }
+
+ /* Skip all leading zeros */
+
+ while (*String == ACPI_ASCII_ZERO)
+ {
+ String++;
+ if (*String == 0)
+ {
+ return_ACPI_STATUS (AE_OK); /* Return value 0 */
+ }
+ }
+
+ /* Perform the base 16 or 10 conversion */
+
+ if (Base == 16)
+ {
+ *ReturnValue = AcpiUtStrtoulBase16 (String, Flags);
+ }
+ else
+ {
+ *ReturnValue = AcpiUtStrtoulBase10 (String, Flags);
+ }
+
+ return_ACPI_STATUS (Status);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiUtStrtoulBase10
+ *
+ * PARAMETERS: String - Null terminated input string
+ * Flags - Conversion info
+ *
+ * RETURN: 64-bit converted integer
+ *
+ * DESCRIPTION: Performs a base 10 conversion of the input string to an
+ * integer value, either 32 or 64 bits.
+ * Note: String must be valid and non-null.
+ *
+ ******************************************************************************/
+
+static UINT64
+AcpiUtStrtoulBase10 (
+ char *String,
+ UINT32 Flags)
+{
+ int AsciiDigit;
+ UINT64 NextValue;
+ UINT64 ReturnValue = 0;
+
+
+ /* Main loop: convert each ASCII byte in the input string */
+
+ while (*String)
+ {
+ AsciiDigit = *String;
+ if (!isdigit (AsciiDigit))
+ {
+ /* Not ASCII 0-9, terminate */
+
+ goto Exit;
+ }
+
+ /* Convert and insert (add) the decimal digit */
+
+ NextValue =
+ (ReturnValue * 10) + (AsciiDigit - ACPI_ASCII_ZERO);
+
+ /* Check for overflow (32 or 64 bit) - return current converted value */
+
+ if (((Flags & ACPI_STRTOUL_32BIT) && (NextValue > ACPI_UINT32_MAX)) ||
+ (NextValue < ReturnValue)) /* 64-bit overflow case */
+ {
+ goto Exit;
+ }
+
+ ReturnValue = NextValue;
+ String++;
+ }
+
+Exit:
+ return (ReturnValue);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiUtStrtoulBase16
+ *
+ * PARAMETERS: String - Null terminated input string
+ * Flags - conversion info
+ *
+ * RETURN: 64-bit converted integer
+ *
+ * DESCRIPTION: Performs a base 16 conversion of the input string to an
+ * integer value, either 32 or 64 bits.
+ * Note: String must be valid and non-null.
+ *
+ ******************************************************************************/
+
+static UINT64
+AcpiUtStrtoulBase16 (
+ char *String,
+ UINT32 Flags)
+{
+ int AsciiDigit;
+ UINT32 ValidDigits = 1;
+ UINT64 ReturnValue = 0;
+
+
+ /* Main loop: convert each ASCII byte in the input string */
+
+ while (*String)
+ {
+ /* Check for overflow (32 or 64 bit) - return current converted value */
+
+ if ((ValidDigits > 16) ||
+ ((ValidDigits > 8) && (Flags & ACPI_STRTOUL_32BIT)))
+ {
+ goto Exit;
+ }
+
+ AsciiDigit = *String;
+ if (!isxdigit (AsciiDigit))
+ {
+ /* Not Hex ASCII A-F, a-f, or 0-9, terminate */
+
+ goto Exit;
+ }
+
+ /* Convert and insert the hex digit */
+
+ ReturnValue =
+ (ReturnValue << 4) | AcpiUtAsciiCharToHex (AsciiDigit);
+
+ String++;
+ ValidDigits++;
+ }
+
+Exit:
+ return (ReturnValue);
+}
diff --git a/src/acpica/source/components/utilities/utxfinit.c b/src/acpica/source/components/utilities/utxfinit.c
index c6f875c..9104d9d 100644
--- a/src/acpica/source/components/utilities/utxfinit.c
+++ b/src/acpica/source/components/utilities/utxfinit.c
@@ -365,7 +365,7 @@ AcpiInitializeObjects (
* all of the tables have been loaded. It is a legacy option and is
* not compatible with other ACPI implementations. See AcpiNsLoadTable.
*/
- if (AcpiGbl_GroupModuleLevelCode)
+ if (!AcpiGbl_ParseTableAsTermList && AcpiGbl_GroupModuleLevelCode)
{
AcpiNsExecModuleCodeList ();
diff --git a/src/acpica/source/include/acdebug.h b/src/acpica/source/include/acdebug.h
index a8c95ad..c7cfc54 100644
--- a/src/acpica/source/include/acdebug.h
+++ b/src/acpica/source/include/acdebug.h
@@ -305,8 +305,8 @@ AcpiDbDisassembleAml (
ACPI_PARSE_OBJECT *Op);
void
-AcpiDbBatchExecute (
- char *CountArg);
+AcpiDbEvaluatePredefinedNames (
+ void);
/*
diff --git a/src/acpica/source/include/acevents.h b/src/acpica/source/include/acevents.h
index 912c940..8a40d28 100644
--- a/src/acpica/source/include/acevents.h
+++ b/src/acpica/source/include/acevents.h
@@ -188,6 +188,11 @@ AcpiEvEnableGpe (
ACPI_GPE_EVENT_INFO *GpeEventInfo);
ACPI_STATUS
+AcpiEvMaskGpe (
+ ACPI_GPE_EVENT_INFO *GpeEventInfo,
+ BOOLEAN IsMasked);
+
+ACPI_STATUS
AcpiEvAddGpeReference (
ACPI_GPE_EVENT_INFO *GpeEventInfo);
diff --git a/src/acpica/source/include/aclocal.h b/src/acpica/source/include/aclocal.h
index 660dccd..c5dc19a 100644
--- a/src/acpica/source/include/aclocal.h
+++ b/src/acpica/source/include/aclocal.h
@@ -622,11 +622,12 @@ typedef union acpi_gpe_dispatch_info
*/
typedef struct acpi_gpe_event_info
{
- union acpi_gpe_dispatch_info Dispatch; /* Either Method, Handler, or NotifyList */
- struct acpi_gpe_register_info *RegisterInfo; /* Backpointer to register info */
- UINT8 Flags; /* Misc info about this GPE */
- UINT8 GpeNumber; /* This GPE */
- UINT8 RuntimeCount; /* References to a run GPE */
+ union acpi_gpe_dispatch_info Dispatch; /* Either Method, Handler, or NotifyList */
+ struct acpi_gpe_register_info *RegisterInfo; /* Backpointer to register info */
+ UINT8 Flags; /* Misc info about this GPE */
+ UINT8 GpeNumber; /* This GPE */
+ UINT8 RuntimeCount; /* References to a run GPE */
+ BOOLEAN DisableForDispatch; /* Masked during dispatching */
} ACPI_GPE_EVENT_INFO;
@@ -639,6 +640,7 @@ typedef struct acpi_gpe_register_info
UINT16 BaseGpeNumber; /* Base GPE number for this register */
UINT8 EnableForWake; /* GPEs to keep enabled when sleeping */
UINT8 EnableForRun; /* GPEs to keep enabled when running */
+ UINT8 MaskForRun; /* GPEs to keep masked when running */
UINT8 EnableMask; /* Current mask of enabled GPEs */
} ACPI_GPE_REGISTER_INFO;
diff --git a/src/acpica/source/include/acnamesp.h b/src/acpica/source/include/acnamesp.h
index 2c43486..9fc9873 100644
--- a/src/acpica/source/include/acnamesp.h
+++ b/src/acpica/source/include/acnamesp.h
@@ -216,6 +216,11 @@ AcpiNsParseTable (
ACPI_NAMESPACE_NODE *StartNode);
ACPI_STATUS
+AcpiNsExecuteTable (
+ UINT32 TableIndex,
+ ACPI_NAMESPACE_NODE *StartNode);
+
+ACPI_STATUS
AcpiNsOneCompleteParse (
UINT32 PassNumber,
UINT32 TableIndex,
@@ -463,6 +468,13 @@ AcpiNsPatternMatch (
char *SearchFor);
ACPI_STATUS
+AcpiNsGetNodeUnlocked (
+ ACPI_NAMESPACE_NODE *PrefixNode,
+ const char *ExternalPathname,
+ UINT32 Flags,
+ ACPI_NAMESPACE_NODE **OutNode);
+
+ACPI_STATUS
AcpiNsGetNode (
ACPI_NAMESPACE_NODE *PrefixNode,
const char *ExternalPathname,
diff --git a/src/acpica/source/include/acparser.h b/src/acpica/source/include/acparser.h
index 406b0f3..35f1ab7 100644
--- a/src/acpica/source/include/acparser.h
+++ b/src/acpica/source/include/acparser.h
@@ -155,6 +155,10 @@ ACPI_STATUS
AcpiPsExecuteMethod (
ACPI_EVALUATE_INFO *Info);
+ACPI_STATUS
+AcpiPsExecuteTable (
+ ACPI_EVALUATE_INFO *Info);
+
/*
* psargs - Parse AML opcode arguments
diff --git a/src/acpica/source/include/acpixf.h b/src/acpica/source/include/acpixf.h
index 68faadc..7d4b67c 100644
--- a/src/acpica/source/include/acpixf.h
+++ b/src/acpica/source/include/acpixf.h
@@ -118,7 +118,7 @@
/* Current ACPICA subsystem version in YYYYMMDD format */
-#define ACPI_CA_VERSION 0x20160729
+#define ACPI_CA_VERSION 0x20160831
#include "acconfig.h"
#include "actypes.h"
@@ -269,6 +269,13 @@ ACPI_INIT_GLOBAL (UINT8, AcpiGbl_DoNotUseXsdt, FALSE);
ACPI_INIT_GLOBAL (UINT8, AcpiGbl_GroupModuleLevelCode, FALSE);
/*
+ * Optionally support module level code by parsing the entire table as
+ * a TermList. Default is FALSE, do not execute entire table until some
+ * lock order issues are fixed.
+ */
+ACPI_INIT_GLOBAL (UINT8, AcpiGbl_ParseTableAsTermList, FALSE);
+
+/*
* Optionally use 32-bit FADT addresses if and when there is a conflict
* (address mismatch) between the 32-bit and 64-bit versions of the
* address. Although ACPICA adheres to the ACPI specification which
@@ -981,6 +988,13 @@ AcpiFinishGpe (
ACPI_HW_DEPENDENT_RETURN_STATUS (
ACPI_STATUS
+AcpiMaskGpe (
+ ACPI_HANDLE GpeDevice,
+ UINT32 GpeNumber,
+ BOOLEAN IsMasked))
+
+ACPI_HW_DEPENDENT_RETURN_STATUS (
+ACPI_STATUS
AcpiMarkGpeForWake (
ACPI_HANDLE GpeDevice,
UINT32 GpeNumber))
diff --git a/src/acpica/source/include/actables.h b/src/acpica/source/include/actables.h
index 31a4b7d..e73430f 100644
--- a/src/acpica/source/include/actables.h
+++ b/src/acpica/source/include/actables.h
@@ -250,6 +250,19 @@ void
AcpiTbUninstallTable (
ACPI_TABLE_DESC *TableDesc);
+ACPI_STATUS
+AcpiTbLoadTable (
+ UINT32 TableIndex,
+ ACPI_NAMESPACE_NODE *ParentNode);
+
+ACPI_STATUS
+AcpiTbInstallAndLoadTable (
+ ACPI_TABLE_HEADER *Table,
+ ACPI_PHYSICAL_ADDRESS Address,
+ UINT8 Flags,
+ BOOLEAN Override,
+ UINT32 *TableIndex);
+
void
AcpiTbTerminate (
void);
@@ -309,12 +322,6 @@ AcpiTbInstallTableWithOverride (
UINT32 *TableIndex);
ACPI_STATUS
-AcpiTbInstallFixedTable (
- ACPI_PHYSICAL_ADDRESS Address,
- char *Signature,
- UINT32 *TableIndex);
-
-ACPI_STATUS ACPI_INIT_FUNCTION
AcpiTbParseRootTable (
ACPI_PHYSICAL_ADDRESS RsdpAddress);
diff --git a/src/acpica/source/include/actypes.h b/src/acpica/source/include/actypes.h
index abc4f7b..6b516bb 100644
--- a/src/acpica/source/include/actypes.h
+++ b/src/acpica/source/include/actypes.h
@@ -817,16 +817,17 @@ typedef UINT32 ACPI_EVENT_TYPE;
* The encoding of ACPI_EVENT_STATUS is illustrated below.
* Note that a set bit (1) indicates the property is TRUE
* (e.g. if bit 0 is set then the event is enabled).
- * +-------------+-+-+-+-+-+
- * | Bits 31:5 |4|3|2|1|0|
- * +-------------+-+-+-+-+-+
- * | | | | | |
- * | | | | | +- Enabled?
- * | | | | +--- Enabled for wake?
- * | | | +----- Status bit set?
- * | | +------- Enable bit set?
- * | +--------- Has a handler?
- * +--------------- <Reserved>
+ * +-------------+-+-+-+-+-+-+
+ * | Bits 31:6 |5|4|3|2|1|0|
+ * +-------------+-+-+-+-+-+-+
+ * | | | | | | |
+ * | | | | | | +- Enabled?
+ * | | | | | +--- Enabled for wake?
+ * | | | | +----- Status bit set?
+ * | | | +------- Enable bit set?
+ * | | +--------- Has a handler?
+ * | +----------- Masked?
+ * +----------------- <Reserved>
*/
typedef UINT32 ACPI_EVENT_STATUS;
@@ -836,6 +837,7 @@ typedef UINT32 ACPI_EVENT_STATUS;
#define ACPI_EVENT_FLAG_STATUS_SET (ACPI_EVENT_STATUS) 0x04
#define ACPI_EVENT_FLAG_ENABLE_SET (ACPI_EVENT_STATUS) 0x08
#define ACPI_EVENT_FLAG_HAS_HANDLER (ACPI_EVENT_STATUS) 0x10
+#define ACPI_EVENT_FLAG_MASKED (ACPI_EVENT_STATUS) 0x20
#define ACPI_EVENT_FLAG_SET ACPI_EVENT_FLAG_STATUS_SET
/* Actions for AcpiSetGpe, AcpiGpeWakeup, AcpiHwLowSetGpe */
@@ -846,14 +848,15 @@ typedef UINT32 ACPI_EVENT_STATUS;
/*
* GPE info flags - Per GPE
- * +-------+-+-+---+
- * | 7:5 |4|3|2:0|
- * +-------+-+-+---+
- * | | | |
- * | | | +-- Type of dispatch:to method, handler, notify, or none
- * | | +----- Interrupt type: edge or level triggered
- * | +------- Is a Wake GPE
- * +------------ <Reserved>
+ * +---+-+-+-+---+
+ * |7:6|5|4|3|2:0|
+ * +---+-+-+-+---+
+ * | | | | |
+ * | | | | +-- Type of dispatch:to method, handler, notify, or none
+ * | | | +----- Interrupt type: edge or level triggered
+ * | | +------- Is a Wake GPE
+ * | +--------- Is GPE masked by the software GPE masking machanism
+ * +------------ <Reserved>
*/
#define ACPI_GPE_DISPATCH_NONE (UINT8) 0x00
#define ACPI_GPE_DISPATCH_METHOD (UINT8) 0x01
@@ -1151,13 +1154,6 @@ typedef struct acpi_statistics
} ACPI_STATISTICS;
-/* Table Event Types */
-
-#define ACPI_TABLE_EVENT_LOAD 0x0
-#define ACPI_TABLE_EVENT_UNLOAD 0x1
-#define ACPI_NUM_TABLE_EVENTS 2
-
-
/*
* Types specific to the OS service interfaces
*/
@@ -1230,9 +1226,14 @@ ACPI_STATUS (*ACPI_TABLE_HANDLER) (
void *Table,
void *Context);
-#define ACPI_TABLE_LOAD 0x0
-#define ACPI_TABLE_UNLOAD 0x1
-#define ACPI_NUM_TABLE_EVENTS 2
+
+/* Table Event Types */
+
+#define ACPI_TABLE_EVENT_LOAD 0x0
+#define ACPI_TABLE_EVENT_UNLOAD 0x1
+#define ACPI_TABLE_EVENT_INSTALL 0x2
+#define ACPI_TABLE_EVENT_UNINSTALL 0x3
+#define ACPI_NUM_TABLE_EVENTS 4
/* Address Spaces (For Operation Regions) */
diff --git a/src/acpica/source/include/acutils.h b/src/acpica/source/include/acutils.h
index 358d1c8..9bc3960 100644
--- a/src/acpica/source/include/acutils.h
+++ b/src/acpica/source/include/acutils.h
@@ -296,14 +296,16 @@ AcpiUtStricmp (
ACPI_STATUS
AcpiUtStrtoul64 (
char *String,
- UINT32 Base,
- UINT32 MaxIntegerByteWidth,
+ UINT32 Flags,
UINT64 *RetInteger);
-/* Values for MaxIntegerByteWidth above */
-
-#define ACPI_MAX32_BYTE_WIDTH 4
-#define ACPI_MAX64_BYTE_WIDTH 8
+/*
+ * Values for Flags above
+ * Note: LIMIT values correspond to AcpiGbl_IntegerByteWidth values (4/8)
+ */
+#define ACPI_STRTOUL_32BIT 0x04 /* 4 bytes */
+#define ACPI_STRTOUL_64BIT 0x08 /* 8 bytes */
+#define ACPI_STRTOUL_BASE16 0x10 /* Default: Base10/16 */
/*
@@ -358,6 +360,11 @@ AcpiUtHexToAsciiChar (
UINT64 Integer,
UINT32 Position);
+ACPI_STATUS
+AcpiUtAsciiToHexByte (
+ char *TwoAsciiChars,
+ UINT8 *ReturnByte);
+
UINT8
AcpiUtAsciiCharToHex (
int HexChar);
diff --git a/src/acpica/source/tools/acpiexec/aehandlers.c b/src/acpica/source/tools/acpiexec/aehandlers.c
index f08ffbe..b52e4d8 100644
--- a/src/acpica/source/tools/acpiexec/aehandlers.c
+++ b/src/acpica/source/tools/acpiexec/aehandlers.c
@@ -187,6 +187,8 @@ static char *TableEvents[] =
{
"LOAD",
"UNLOAD",
+ "INSTALL",
+ "UNINSTALL",
"UNKNOWN"
};
#endif /* !ACPI_REDUCED_HARDWARE */
diff --git a/src/acpica/source/tools/acpiexec/aeinitfile.c b/src/acpica/source/tools/acpiexec/aeinitfile.c
index b1b60cd..6a2eeb3 100644
--- a/src/acpica/source/tools/acpiexec/aeinitfile.c
+++ b/src/acpica/source/tools/acpiexec/aeinitfile.c
@@ -244,7 +244,7 @@ CleanupAndExit:
*
* RETURN: None
*
- * DESCRIPTION: Perform an overrided for a single namespace object
+ * DESCRIPTION: Perform an override for a single namespace object
*
*****************************************************************************/
@@ -275,8 +275,8 @@ AeDoOneOverride (
/* Extract the 64-bit integer */
- Status = AcpiUtStrtoul64 (ValueString, ACPI_ANY_BASE,
- ACPI_MAX64_BYTE_WIDTH, &Value);
+ Status = AcpiUtStrtoul64 (ValueString,
+ (ACPI_STRTOUL_BASE16 | ACPI_STRTOUL_64BIT), &Value);
if (ACPI_FAILURE (Status))
{
AcpiOsPrintf ("%s %s\n", ValueString,
--
2.9.3
More information about the fwts-devel
mailing list