[PATCH 1/2] ACPICA: update to version 20130927.
Colin King
colin.king at canonical.com
Thu Oct 3 10:36:03 UTC 2013
From: Colin Ian King <colin.king at canonical.com>
Full list of changes in ACPICA can be found here:
https://lists.acpica.org/pipermail/devel/2013-September/000561.html
Signed-off-by: Colin Ian King <colin.king at canonical.com>
---
src/acpica/Makefile.am | 1 +
src/acpica/fwts_acpica.c | 22 +-
src/acpica/source/common/acgetline.c | 512 +++++++++++++++++++++
src/acpica/source/common/adfile.c | 12 +-
src/acpica/source/common/adisasm.c | 4 +
src/acpica/source/common/adwalk.c | 10 +-
src/acpica/source/common/dmextern.c | 373 +++++++++++++--
src/acpica/source/common/dmtable.c | 2 +-
src/acpica/source/compiler/aslcompile.c | 25 +-
src/acpica/source/compiler/aslcompiler.h | 5 -
src/acpica/source/compiler/aslerror.c | 4 +-
src/acpica/source/compiler/aslglobal.h | 1 +
src/acpica/source/compiler/aslmain.c | 33 +-
src/acpica/source/compiler/aslstartup.c | 173 +------
src/acpica/source/compiler/dtcompile.c | 2 +-
src/acpica/source/compiler/fwts_iasl_interface.c | 4 +-
src/acpica/source/components/debugger/dbcmds.c | 8 +
src/acpica/source/components/debugger/dbexec.c | 44 +-
src/acpica/source/components/debugger/dbfileio.c | 11 +-
src/acpica/source/components/debugger/dbhistry.c | 35 +-
src/acpica/source/components/debugger/dbinput.c | 46 +-
src/acpica/source/components/debugger/dbnames.c | 51 +-
src/acpica/source/components/debugger/dbxface.c | 4 +
src/acpica/source/components/events/evgpe.c | 3 +
src/acpica/source/components/events/evgpeutil.c | 2 +-
src/acpica/source/components/events/evmisc.c | 18 +-
src/acpica/source/components/events/evregion.c | 26 +-
src/acpica/source/components/events/evsci.c | 87 +++-
src/acpica/source/components/events/evxface.c | 164 +++++++
src/acpica/source/components/events/evxfevnt.c | 1 +
src/acpica/source/components/events/evxfgpe.c | 1 +
src/acpica/source/components/events/evxfregn.c | 1 +
src/acpica/source/components/executer/exstore.c | 168 ++++---
src/acpica/source/components/hardware/hwxface.c | 35 +-
src/acpica/source/components/hardware/hwxfsleep.c | 2 +
src/acpica/source/components/namespace/nsdump.c | 159 +++++++
src/acpica/source/components/namespace/nsxfeval.c | 18 +-
src/acpica/source/components/namespace/nsxfname.c | 1 +
src/acpica/source/components/namespace/nsxfobj.c | 1 +
src/acpica/source/components/resources/rsxface.c | 1 +
src/acpica/source/components/tables/tbinstal.c | 9 +-
src/acpica/source/components/tables/tbprint.c | 19 +-
src/acpica/source/components/tables/tbxface.c | 5 +-
src/acpica/source/components/tables/tbxfload.c | 3 +-
src/acpica/source/components/tables/tbxfroot.c | 3 +-
src/acpica/source/components/utilities/utalloc.c | 131 ++----
src/acpica/source/components/utilities/utdebug.c | 3 +-
src/acpica/source/components/utilities/utexcep.c | 1 +
src/acpica/source/components/utilities/utglobal.c | 4 +-
src/acpica/source/components/utilities/utstring.c | 75 +++
src/acpica/source/components/utilities/uttrack.c | 29 +-
src/acpica/source/components/utilities/utxface.c | 2 +-
src/acpica/source/components/utilities/utxferror.c | 1 +
src/acpica/source/components/utilities/utxfinit.c | 6 +-
src/acpica/source/include/acconfig.h | 2 +
src/acpica/source/include/acdebug.h | 12 +
src/acpica/source/include/acdisasm.h | 3 +
src/acpica/source/include/acevents.h | 10 +-
src/acpica/source/include/acexcep.h | 8 +-
src/acpica/source/include/acglobal.h | 18 +-
src/acpica/source/include/aclocal.h | 16 +-
src/acpica/source/include/acmacros.h | 26 --
src/acpica/source/include/acnames.h | 25 +-
src/acpica/source/include/acnamesp.h | 8 +
src/acpica/source/include/acpiosxf.h | 122 ++++-
src/acpica/source/include/acpixf.h | 54 ++-
src/acpica/source/include/actypes.h | 51 +-
src/acpica/source/include/acutils.h | 35 +-
src/acpica/source/include/platform/acgcc.h | 2 +-
src/acpica/source/include/platform/aclinux.h | 113 ++++-
.../source/os_specific/service_layers/osunixxf.c | 131 +++++-
src/acpica/source/tools/acpiexec/aehandlers.c | 84 +++-
72 files changed, 2457 insertions(+), 624 deletions(-)
create mode 100644 src/acpica/source/common/acgetline.c
diff --git a/src/acpica/Makefile.am b/src/acpica/Makefile.am
index 30f0faa..d4fc5dd 100644
--- a/src/acpica/Makefile.am
+++ b/src/acpica/Makefile.am
@@ -240,6 +240,7 @@ libfwtsacpica_la_SOURCES = \
$(ACPICA_COMP)/utilities/utxfinit.c \
$(ACPICA_COMP)/utilities/uterror.c \
$(ACPICA_COMP)/utilities/utbuffer.c \
+ $(ACPICA_COMMON)/acgetline.c \
$(ACPICA_SRC)/tools/acpiexec/aehandlers.c
libfwtsacpica_la_LIBADD = \
diff --git a/src/acpica/fwts_acpica.c b/src/acpica/fwts_acpica.c
index ec85115..e86d251 100644
--- a/src/acpica/fwts_acpica.c
+++ b/src/acpica/fwts_acpica.c
@@ -922,11 +922,6 @@ int fwts_acpica_init(fwts_framework *fw)
AcpiOsRedirectOutput(stderr);
- if (ACPI_FAILURE(AcpiInitializeSubsystem())) {
- fwts_log_error(fw, "Failed to initialise ACPICA subsystem.");
- return FWTS_ERROR;
- }
-
/* Clone FADT, make sure it points to a DSDT in user space */
if (fwts_acpi_find_table(fw, "FACP", 0, &table) != FWTS_OK)
return FWTS_ERROR;
@@ -1061,27 +1056,34 @@ int fwts_acpica_init(fwts_framework *fw)
fwts_acpica_RSDP = NULL;
}
+ if (ACPI_FAILURE(AcpiInitializeSubsystem())) {
+ fwts_log_error(fw, "Failed to initialise ACPICA subsystem.");
+ goto failed;
+ }
+
if (AcpiInitializeTables(Tables, ACPI_MAX_INIT_TABLES, TRUE) != AE_OK) {
fwts_log_error(fw, "Failed to initialise tables.");
- return FWTS_ERROR;
+ goto failed;
}
if (AcpiReallocateRootTable() != AE_OK) {
fwts_log_error(fw, "Failed to reallocate root table.");
- return FWTS_ERROR;
+ goto failed;
}
if (AcpiLoadTables() != AE_OK) {
fwts_log_error(fw, "Failed to load tables.");
- return FWTS_ERROR;
+ goto failed;
}
-
(void)fwtsInstallEarlyHandlers(fw);
AcpiEnableSubsystem(init_flags);
AcpiInitializeObjects(init_flags);
fwts_acpica_init_called = true;
-
return FWTS_OK;
+
+failed:
+ AcpiTerminate();
+ return FWTS_ERROR;
}
#define FWTS_ACPICA_FREE(x) \
diff --git a/src/acpica/source/common/acgetline.c b/src/acpica/source/common/acgetline.c
new file mode 100644
index 0000000..ae68ed7
--- /dev/null
+++ b/src/acpica/source/common/acgetline.c
@@ -0,0 +1,512 @@
+/******************************************************************************
+ *
+ * Module Name: acgetline - local line editing
+ *
+ *****************************************************************************/
+
+/******************************************************************************
+ *
+ * 1. Copyright Notice
+ *
+ * Some or all of this work - Copyright (c) 1999 - 2013, Intel Corp.
+ * All rights reserved.
+ *
+ * 2. License
+ *
+ * 2.1. This is your license from Intel Corp. under its intellectual property
+ * rights. You may have additional license terms from the party that provided
+ * you this software, covering your right to use that party's intellectual
+ * property rights.
+ *
+ * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
+ * copy of the source code appearing in this file ("Covered Code") an
+ * irrevocable, perpetual, worldwide license under Intel's copyrights in the
+ * base code distributed originally by Intel ("Original Intel Code") to copy,
+ * make derivatives, distribute, use and display any portion of the Covered
+ * Code in any form, with the right to sublicense such rights; and
+ *
+ * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
+ * license (with the right to sublicense), under only those claims of Intel
+ * patents that are infringed by the Original Intel Code, to make, use, sell,
+ * offer to sell, and import the Covered Code and derivative works thereof
+ * solely to the minimum extent necessary to exercise the above copyright
+ * license, and in no event shall the patent license extend to any additions
+ * to or modifications of the Original Intel Code. No other license or right
+ * is granted directly or by implication, estoppel or otherwise;
+ *
+ * The above copyright and patent license is granted only if the following
+ * conditions are met:
+ *
+ * 3. Conditions
+ *
+ * 3.1. Redistribution of Source with Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification with rights to further distribute source must include
+ * the above Copyright Notice, the above License, this list of Conditions,
+ * and the following Disclaimer and Export Compliance provision. In addition,
+ * Licensee must cause all Covered Code to which Licensee contributes to
+ * contain a file documenting the changes Licensee made to create that Covered
+ * Code and the date of any change. Licensee must include in that file the
+ * documentation of any changes made by any predecessor Licensee. Licensee
+ * must include a prominent statement that the modification is derived,
+ * directly or indirectly, from Original Intel Code.
+ *
+ * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification without rights to further distribute source must
+ * include the following Disclaimer and Export Compliance provision in the
+ * documentation and/or other materials provided with distribution. In
+ * addition, Licensee may not authorize further sublicense of source of any
+ * portion of the Covered Code, and must include terms to the effect that the
+ * license from Licensee to its licensee is limited to the intellectual
+ * property embodied in the software Licensee provides to its licensee, and
+ * not to intellectual property embodied in modifications its licensee may
+ * make.
+ *
+ * 3.3. Redistribution of Executable. Redistribution in executable form of any
+ * substantial portion of the Covered Code or modification must reproduce the
+ * above Copyright Notice, and the following Disclaimer and Export Compliance
+ * provision in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3.4. Intel retains all right, title, and interest in and to the Original
+ * Intel Code.
+ *
+ * 3.5. Neither the name Intel nor any other trademark owned or controlled by
+ * Intel shall be used in advertising or otherwise to promote the sale, use or
+ * other dealings in products derived from or relating to the Covered Code
+ * without prior written authorization from Intel.
+ *
+ * 4. Disclaimer and Export Compliance
+ *
+ * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
+ * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
+ * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
+ * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
+ * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
+ * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
+ * PARTICULAR PURPOSE.
+ *
+ * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
+ * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
+ * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
+ * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
+ * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
+ * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
+ * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
+ * LIMITED REMEDY.
+ *
+ * 4.3. Licensee shall not export, either directly or indirectly, any of this
+ * software or system incorporating such software without first obtaining any
+ * required license or other approval from the U. S. Department of Commerce or
+ * any other agency or department of the United States Government. In the
+ * event Licensee exports any such software from the United States or
+ * re-exports any such software from a foreign destination, Licensee shall
+ * ensure that the distribution and export/re-export of the software is in
+ * compliance with all laws, regulations, orders, or other restrictions of the
+ * U.S. Export Administration Regulations. Licensee agrees that neither it nor
+ * any of its subsidiaries will export/re-export any technical data, process,
+ * software, or service, directly or indirectly, to any country for which the
+ * United States government or any agency thereof requires an export license,
+ * other governmental approval, or letter of assurance, without first obtaining
+ * such license, approval or letter.
+ *
+ *****************************************************************************/
+
+#include "acpi.h"
+#include "accommon.h"
+#include "amlcode.h"
+#include "acparser.h"
+#include "acdebug.h"
+
+#include <stdio.h>
+
+/*
+ * This is an os-independent implementation of line-editing services needed
+ * by the AcpiExec utility. It uses getchar() and putchar() and the existing
+ * history support provided by the AML debugger. It assumes that the terminal
+ * is in the correct line-editing mode such as raw and noecho. The OSL
+ * interface AcpiOsInitialize should do this. AcpiOsTerminate should put the
+ * terminal back into the original mode.
+ */
+#define _COMPONENT ACPI_OS_SERVICES
+ ACPI_MODULE_NAME ("acgetline")
+
+
+/* Local prototypes */
+
+static void
+AcpiAcClearLine (
+ UINT32 EndOfLine,
+ UINT32 CursorPosition);
+
+/* Various ASCII constants */
+
+#define _ASCII_NUL 0
+#define _ASCII_BACKSPACE 0x08
+#define _ASCII_TAB 0x09
+#define _ASCII_ESCAPE 0x1B
+#define _ASCII_SPACE 0x20
+#define _ASCII_LEFT_BRACKET 0x5B
+#define _ASCII_DEL 0x7F
+#define _ASCII_UP_ARROW 'A'
+#define _ASCII_DOWN_ARROW 'B'
+#define _ASCII_RIGHT_ARROW 'C'
+#define _ASCII_LEFT_ARROW 'D'
+#define _ASCII_NEWLINE '\n'
+
+extern UINT32 AcpiGbl_NextCmdNum;
+
+/* Erase a single character on the input command line */
+
+#define ACPI_CLEAR_CHAR() \
+ putchar (_ASCII_BACKSPACE); \
+ putchar (_ASCII_SPACE); \
+ putchar (_ASCII_BACKSPACE);
+
+/* Backup cursor by Count positions */
+
+#define ACPI_BACKUP_CURSOR(i, Count) \
+ for (i = 0; i < (Count); i++) \
+ {putchar (_ASCII_BACKSPACE);}
+
+
+/******************************************************************************
+ *
+ * FUNCTION: AcpiAcClearLine
+ *
+ * PARAMETERS: EndOfLine - Current end-of-line index
+ * CursorPosition - Current cursor position within line
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Clear the entire command line the hard way, but probably the
+ * most portable.
+ *
+ *****************************************************************************/
+
+static void
+AcpiAcClearLine (
+ UINT32 EndOfLine,
+ UINT32 CursorPosition)
+{
+ UINT32 i;
+
+
+ if (CursorPosition < EndOfLine)
+ {
+ /* Clear line from current position to end of line */
+
+ for (i = 0; i < (EndOfLine - CursorPosition); i++)
+ {
+ putchar (' ');
+ }
+ }
+
+ /* Clear the entire line */
+
+ for (; EndOfLine > 0; EndOfLine--)
+ {
+ ACPI_CLEAR_CHAR ();
+ }
+}
+
+
+/******************************************************************************
+ *
+ * FUNCTION: AcpiOsGetLine
+ *
+ * PARAMETERS: Buffer - Where to return the command line
+ * BufferLength - Maximum length of Buffer
+ * BytesRead - Where the actual byte count is returned
+ *
+ * RETURN: Status and actual bytes read
+ *
+ * DESCRIPTION: Get the next input line from the terminal. NOTE: terminal
+ * is expected to be in a mode that supports line-editing (raw,
+ * noecho). This function is intended to be very portable. Also,
+ * it uses the history support implemented in the AML debugger.
+ *
+ *****************************************************************************/
+
+ACPI_STATUS
+AcpiOsGetLine (
+ char *Buffer,
+ UINT32 BufferLength,
+ UINT32 *BytesRead)
+{
+ char *NextCommand;
+ UINT32 MaxCommandIndex = AcpiGbl_NextCmdNum - 1;
+ UINT32 CurrentCommandIndex = MaxCommandIndex;
+ UINT32 PreviousCommandIndex = MaxCommandIndex;
+ int InputChar;
+ UINT32 CursorPosition = 0;
+ UINT32 EndOfLine = 0;
+ UINT32 i;
+
+
+ /* Always clear the line buffer before we read a new line */
+
+ memset (Buffer, 0, BufferLength);
+
+ /*
+ * This loop gets one character at a time (except for esc sequences)
+ * until a newline or error is detected.
+ *
+ * Note: Don't attempt to write terminal control ESC sequences, even
+ * though it makes certain things more difficult.
+ */
+ while (1)
+ {
+ if (EndOfLine >= (BufferLength - 1))
+ {
+ return (AE_BUFFER_OVERFLOW);
+ }
+
+ InputChar = getchar ();
+ switch (InputChar)
+ {
+ default: /* This is the normal character case */
+
+ /* Echo the character (at EOL) and copy it to the line buffer */
+
+ if (EndOfLine == CursorPosition)
+ {
+ putchar (InputChar);
+ Buffer[EndOfLine] = (char) InputChar;
+
+ EndOfLine++;
+ CursorPosition++;
+ Buffer[EndOfLine] = 0;
+ continue;
+ }
+
+ /* Insert character into the middle of the buffer */
+
+ memmove (&Buffer[CursorPosition + 1], &Buffer[CursorPosition],
+ (EndOfLine - CursorPosition + 1));
+
+ Buffer [CursorPosition] = (char) InputChar;
+ Buffer [EndOfLine + 1] = 0;
+
+ /* Display the new part of line starting at the new character */
+
+ fprintf (stdout, "%s", &Buffer[CursorPosition]);
+
+ /* Restore cursor */
+
+ ACPI_BACKUP_CURSOR (i, EndOfLine - CursorPosition);
+ CursorPosition++;
+ EndOfLine++;
+ continue;
+
+ case _ASCII_DEL: /* Backspace key */
+
+ if (!EndOfLine) /* Any characters on the command line? */
+ {
+ continue;
+ }
+
+ if (EndOfLine == CursorPosition) /* Erase the final character */
+ {
+ ACPI_CLEAR_CHAR ();
+ EndOfLine--;
+ CursorPosition--;
+ continue;
+ }
+
+ if (!CursorPosition) /* Do not backup beyond start of line */
+ {
+ continue;
+ }
+
+ /* Remove the character from the line */
+
+ memmove (&Buffer[CursorPosition - 1], &Buffer[CursorPosition],
+ (EndOfLine - CursorPosition + 1));
+
+ /* Display the new part of line starting at the new character */
+
+ putchar (_ASCII_BACKSPACE);
+ fprintf (stdout, "%s ", &Buffer[CursorPosition - 1]);
+
+ /* Restore cursor */
+
+ ACPI_BACKUP_CURSOR (i, EndOfLine - CursorPosition + 1);
+ EndOfLine--;
+ if (CursorPosition > 0)
+ {
+ CursorPosition--;
+ }
+ continue;
+
+ case _ASCII_NEWLINE: /* Normal exit case at end of command line */
+ case _ASCII_NUL:
+
+ /* Return the number of bytes in the command line string */
+
+ if (BytesRead)
+ {
+ *BytesRead = EndOfLine;
+ }
+
+ /* Echo, terminate string buffer, and exit */
+
+ putchar (InputChar);
+ Buffer[EndOfLine] = 0;
+ return (AE_OK);
+
+ case _ASCII_TAB:
+
+ /* Ignore */
+
+ continue;
+
+ case EOF:
+
+ return (AE_ERROR);
+
+ case _ASCII_ESCAPE:
+
+ /* Check for escape sequences of the form "ESC[x" */
+
+ InputChar = getchar ();
+ if (InputChar != _ASCII_LEFT_BRACKET)
+ {
+ continue; /* Ignore this ESC, does not have the '[' */
+ }
+
+ /* Get the code following the ESC [ */
+
+ InputChar = getchar (); /* Backup one character */
+ switch (InputChar)
+ {
+ case _ASCII_LEFT_ARROW:
+
+ if (CursorPosition > 0)
+ {
+ putchar (_ASCII_BACKSPACE);
+ CursorPosition--;
+ }
+ continue;
+
+ case _ASCII_RIGHT_ARROW:
+ /*
+ * Move one character forward. Do this without sending
+ * ESC sequence to the terminal for max portability.
+ */
+ if (CursorPosition < EndOfLine)
+ {
+ /* Backup to start of line and print the entire line */
+
+ ACPI_BACKUP_CURSOR (i, CursorPosition);
+ fprintf (stdout, "%s", Buffer);
+
+ /* Backup to where the cursor should be */
+
+ CursorPosition++;
+ ACPI_BACKUP_CURSOR (i, EndOfLine - CursorPosition);
+ }
+ continue;
+
+ case _ASCII_UP_ARROW:
+
+ /* If no commands available or at start of history list, ignore */
+
+ if (!CurrentCommandIndex)
+ {
+ continue;
+ }
+
+ /* Manage our up/down progress */
+
+ if (CurrentCommandIndex > PreviousCommandIndex)
+ {
+ CurrentCommandIndex = PreviousCommandIndex;
+ }
+
+ /* Get the historical command from the debugger */
+
+ NextCommand = AcpiDbGetHistoryByIndex (CurrentCommandIndex);
+ if (!NextCommand)
+ {
+ return (AE_ERROR);
+ }
+
+ /* Make this the active command and echo it */
+
+ AcpiAcClearLine (EndOfLine, CursorPosition);
+ strcpy (Buffer, NextCommand);
+ fprintf (stdout, "%s", Buffer);
+ EndOfLine = CursorPosition = strlen (Buffer);
+
+ PreviousCommandIndex = CurrentCommandIndex;
+ CurrentCommandIndex--;
+ continue;
+
+ case _ASCII_DOWN_ARROW:
+
+ if (!MaxCommandIndex) /* Any commands available? */
+ {
+ continue;
+ }
+
+ /* Manage our up/down progress */
+
+ if (CurrentCommandIndex < PreviousCommandIndex)
+ {
+ CurrentCommandIndex = PreviousCommandIndex;
+ }
+
+ /* If we are the end of the history list, output a clear new line */
+
+ if ((CurrentCommandIndex + 1) > MaxCommandIndex)
+ {
+ AcpiAcClearLine (EndOfLine, CursorPosition);
+ EndOfLine = CursorPosition = 0;
+ PreviousCommandIndex = CurrentCommandIndex;
+ continue;
+ }
+
+ PreviousCommandIndex = CurrentCommandIndex;
+ CurrentCommandIndex++;
+
+ /* Get the historical command from the debugger */
+
+ NextCommand = AcpiDbGetHistoryByIndex (CurrentCommandIndex);
+ if (!NextCommand)
+ {
+ return (AE_ERROR);
+ }
+
+ /* Make this the active command and echo it */
+
+ AcpiAcClearLine (EndOfLine, CursorPosition);
+ strcpy (Buffer, NextCommand);
+ fprintf (stdout, "%s", Buffer);
+ EndOfLine = CursorPosition = strlen (Buffer);
+ continue;
+
+ case 0x31:
+ case 0x32:
+ case 0x33:
+ case 0x34:
+ case 0x35:
+ case 0x36:
+ /*
+ * Ignore the various keys like insert/delete/home/end, etc.
+ * But we must eat the final character of the ESC sequence.
+ */
+ InputChar = getchar ();
+ continue;
+
+ default:
+
+ /* Ignore random escape sequences that we don't care about */
+
+ continue;
+ }
+ continue;
+ }
+ }
+}
diff --git a/src/acpica/source/common/adfile.c b/src/acpica/source/common/adfile.c
index 1af4cc2..57cb580 100644
--- a/src/acpica/source/common/adfile.c
+++ b/src/acpica/source/common/adfile.c
@@ -360,7 +360,6 @@ FlSplitInputPathname (
*OutDirectoryPath = NULL;
- *OutFilename = NULL;
if (!InputPath)
{
@@ -402,10 +401,19 @@ FlSplitInputPathname (
if (!Filename)
{
+ ACPI_FREE(DirectoryPath);
return (AE_NO_MEMORY);
}
*OutDirectoryPath = DirectoryPath;
- *OutFilename = Filename;
+
+ if (OutFilename)
+ {
+ *OutFilename = Filename;
+ }
+ else
+ {
+ ACPI_FREE(Filename);
+ }
return (AE_OK);
}
diff --git a/src/acpica/source/common/adisasm.c b/src/acpica/source/common/adisasm.c
index ea59365..f14ae17 100644
--- a/src/acpica/source/common/adisasm.c
+++ b/src/acpica/source/common/adisasm.c
@@ -413,6 +413,10 @@ AdAmlDisassemble (
{
AcpiDmClearExternalList ();
}
+
+ /* Load any externals defined in the optional external ref file */
+
+ AcpiDmGetExternalsFromFile ();
}
else
{
diff --git a/src/acpica/source/common/adwalk.c b/src/acpica/source/common/adwalk.c
index ecb3860..76ef5df 100644
--- a/src/acpica/source/common/adwalk.c
+++ b/src/acpica/source/common/adwalk.c
@@ -445,10 +445,18 @@ AcpiDmDumpDescending (
switch (Op->Common.AmlOpcode)
{
case AML_BYTE_OP:
+
+ AcpiOsPrintf ("%2.2X", (UINT32) Op->Common.Value.Integer);
+ break;
+
case AML_WORD_OP:
+
+ AcpiOsPrintf ("%4.4X", (UINT32) Op->Common.Value.Integer);
+ break;
+
case AML_DWORD_OP:
- AcpiOsPrintf ("%X", (UINT32) Op->Common.Value.Integer);
+ AcpiOsPrintf ("%8.8X", (UINT32) Op->Common.Value.Integer);
break;
case AML_QWORD_OP:
diff --git a/src/acpica/source/common/dmextern.c b/src/acpica/source/common/dmextern.c
index 87aeddc..5b3a8b1 100644
--- a/src/acpica/source/common/dmextern.c
+++ b/src/acpica/source/common/dmextern.c
@@ -118,7 +118,9 @@
#include "amlcode.h"
#include "acnamesp.h"
#include "acdisasm.h"
+#include "aslcompiler.h"
#include <stdio.h>
+#include <errno.h>
/*
@@ -159,6 +161,8 @@ static const char *AcpiGbl_DmTypeNames[] =
/* 19 */ ", FieldUnitObj"
};
+#define METHOD_SEPARATORS " \t,()\n"
+
/* Local prototypes */
@@ -171,6 +175,12 @@ AcpiDmNormalizeParentPrefix (
ACPI_PARSE_OBJECT *Op,
char *Path);
+static void
+AcpiDmAddToExternalListFromFile (
+ char *Path,
+ UINT8 Type,
+ UINT32 Value);
+
/*******************************************************************************
*
@@ -341,48 +351,41 @@ Cleanup:
ACPI_STATUS
AcpiDmAddToExternalFileList (
- char *PathList)
+ char *Pathname)
{
ACPI_EXTERNAL_FILE *ExternalFile;
- char *Path;
- char *TmpPath;
+ char *LocalPathname;
- if (!PathList)
+ if (!Pathname)
{
return (AE_OK);
}
- Path = strtok (PathList, ",");
-
- while (Path)
+ LocalPathname = ACPI_ALLOCATE (strlen (Pathname) + 1);
+ if (!LocalPathname)
{
- TmpPath = ACPI_ALLOCATE_ZEROED (ACPI_STRLEN (Path) + 1);
- if (!TmpPath)
- {
- return (AE_NO_MEMORY);
- }
-
- ACPI_STRCPY (TmpPath, Path);
+ return (AE_NO_MEMORY);
+ }
- ExternalFile = ACPI_ALLOCATE_ZEROED (sizeof (ACPI_EXTERNAL_FILE));
- if (!ExternalFile)
- {
- ACPI_FREE (TmpPath);
- return (AE_NO_MEMORY);
- }
+ ExternalFile = ACPI_ALLOCATE_ZEROED (sizeof (ACPI_EXTERNAL_FILE));
+ if (!ExternalFile)
+ {
+ ACPI_FREE (LocalPathname);
+ return (AE_NO_MEMORY);
+ }
- ExternalFile->Path = TmpPath;
+ /* Take a copy of the file pathname */
- if (AcpiGbl_ExternalFileList)
- {
- ExternalFile->Next = AcpiGbl_ExternalFileList;
- }
+ strcpy (LocalPathname, Pathname);
+ ExternalFile->Path = LocalPathname;
- AcpiGbl_ExternalFileList = ExternalFile;
- Path = strtok (NULL, ",");
+ if (AcpiGbl_ExternalFileList)
+ {
+ ExternalFile->Next = AcpiGbl_ExternalFileList;
}
+ AcpiGbl_ExternalFileList = ExternalFile;
return (AE_OK);
}
@@ -516,7 +519,7 @@ AcpiDmAddToExternalList (
(NextExternal->Value != Value))
{
ACPI_ERROR ((AE_INFO,
- "Argument count mismatch for method %s %u %u",
+ "External method arg count mismatch %s: Current %u, attempted %u",
NextExternal->Path, NextExternal->Value, Value));
}
@@ -608,6 +611,275 @@ AcpiDmAddToExternalList (
/*******************************************************************************
*
+ * FUNCTION: AcpiDmGetExternalsFromFile
+ *
+ * PARAMETERS: None
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Process the optional external reference file.
+ *
+ * Each line in the file should be of the form:
+ * External (<Method namepath>, MethodObj, <ArgCount>)
+ *
+ * Example:
+ * External (_SB_.PCI0.XHC_.PS0X, MethodObj, 4)
+ *
+ ******************************************************************************/
+
+void
+AcpiDmGetExternalsFromFile (
+ void)
+{
+ FILE *ExternalRefFile;
+ char *Token;
+ char *MethodName;
+ UINT32 ArgCount;
+ UINT32 ImportCount = 0;
+
+
+ if (!Gbl_ExternalRefFilename)
+ {
+ return;
+ }
+
+ /* Open the file */
+
+ ExternalRefFile = fopen (Gbl_ExternalRefFilename, "r");
+ if (!ExternalRefFile)
+ {
+ fprintf (stderr, "Could not open external reference file \"%s\"\n",
+ Gbl_ExternalRefFilename);
+ return;
+ }
+
+ /* Each line defines a method */
+
+ while (fgets (StringBuffer, ASL_MSG_BUFFER_SIZE, ExternalRefFile))
+ {
+ Token = strtok (StringBuffer, METHOD_SEPARATORS); /* "External" */
+ if (!Token) continue;
+ if (strcmp (Token, "External")) continue;
+
+ MethodName = strtok (NULL, METHOD_SEPARATORS); /* Method namepath */
+ if (!MethodName) continue;
+
+ Token = strtok (NULL, METHOD_SEPARATORS); /* "MethodObj" */
+ if (!Token) continue;
+ if (strcmp (Token, "MethodObj")) continue;
+
+ Token = strtok (NULL, METHOD_SEPARATORS); /* Arg count */
+ if (!Token) continue;
+
+ /* Convert arg count string to an integer */
+
+ errno = 0;
+ ArgCount = strtoul (Token, NULL, 0);
+ if (errno)
+ {
+ fprintf (stderr, "Invalid argument count (%s)\n", Token);
+ continue;
+ }
+ if (ArgCount > 7)
+ {
+ fprintf (stderr, "Invalid argument count (%u)\n", ArgCount);
+ continue;
+ }
+
+ /* Add this external to the global list */
+
+ AcpiOsPrintf ("%s: Importing method external (%u arguments) %s\n",
+ Gbl_ExternalRefFilename, ArgCount, MethodName);
+
+ AcpiDmAddToExternalListFromFile (MethodName, ACPI_TYPE_METHOD, ArgCount | 0x80);
+ ImportCount++;
+ }
+
+ if (!ImportCount)
+ {
+ fprintf (stderr, "Did not find any external methods in reference file \"%s\"\n",
+ Gbl_ExternalRefFilename);
+ }
+ else
+ {
+ /* Add the external(s) to the namespace */
+
+ AcpiDmAddExternalsToNamespace ();
+
+ AcpiOsPrintf ("%s: Imported %u external method definitions\n",
+ Gbl_ExternalRefFilename, ImportCount);
+ }
+
+ fclose (ExternalRefFile);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDmAddToExternalListFromFile
+ *
+ * PARAMETERS: Path - Internal (AML) path to the object
+ * Type - ACPI object type to be added
+ * Value - Arg count if adding a Method object
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Insert a new name into the global list of Externals which
+ * will in turn be later emitted as an External() declaration
+ * in the disassembled output.
+ *
+ ******************************************************************************/
+
+static void
+AcpiDmAddToExternalListFromFile (
+ char *Path,
+ UINT8 Type,
+ UINT32 Value)
+{
+ char *InternalPath;
+ char *ExternalPath;
+ ACPI_EXTERNAL_LIST *NewExternal;
+ ACPI_EXTERNAL_LIST *NextExternal;
+ ACPI_EXTERNAL_LIST *PrevExternal = NULL;
+ ACPI_STATUS Status;
+ BOOLEAN Resolved = FALSE;
+
+
+ if (!Path)
+ {
+ return;
+ }
+
+ /* TBD: Add a flags parameter */
+
+ if (Type == ACPI_TYPE_METHOD)
+ {
+ if (Value & 0x80)
+ {
+ Resolved = TRUE;
+ }
+ Value &= 0x07;
+ }
+
+ /*
+ * We don't want External() statements to contain a leading '\'.
+ * This prevents duplicate external statements of the form:
+ *
+ * External (\ABCD)
+ * External (ABCD)
+ *
+ * This would cause a compile time error when the disassembled
+ * output file is recompiled.
+ */
+ if ((*Path == AML_ROOT_PREFIX) && (Path[1]))
+ {
+ Path++;
+ }
+
+ /* Check all existing externals to ensure no duplicates */
+
+ NextExternal = AcpiGbl_ExternalList;
+ while (NextExternal)
+ {
+ if (!ACPI_STRCMP (Path, NextExternal->Path))
+ {
+ /* Duplicate method, check that the Value (ArgCount) is the same */
+
+ if ((NextExternal->Type == ACPI_TYPE_METHOD) &&
+ (NextExternal->Value != Value))
+ {
+ ACPI_ERROR ((AE_INFO,
+ "(File) External method arg count mismatch %s: Current %u, override to %u",
+ NextExternal->Path, NextExternal->Value, Value));
+
+ /* Override, since new value came from external reference file */
+
+ NextExternal->Value = Value;
+ }
+
+ /* Allow upgrade of type from ANY */
+
+ else if (NextExternal->Type == ACPI_TYPE_ANY)
+ {
+ NextExternal->Type = Type;
+ NextExternal->Value = Value;
+ }
+
+ return;
+ }
+
+ NextExternal = NextExternal->Next;
+ }
+
+ /* Get the internal pathname (AML format) */
+
+ Status = AcpiNsInternalizeName (Path, &InternalPath);
+ if (ACPI_FAILURE (Status))
+ {
+ return;
+ }
+
+ /* Allocate and init a new External() descriptor */
+
+ NewExternal = ACPI_ALLOCATE_ZEROED (sizeof (ACPI_EXTERNAL_LIST));
+ if (!NewExternal)
+ {
+ ACPI_FREE (InternalPath);
+ return;
+ }
+
+ /* Must copy and normalize the input path */
+
+ AcpiNsExternalizeName (ACPI_UINT32_MAX, InternalPath, NULL, &ExternalPath);
+
+ NewExternal->Path = ExternalPath;
+ NewExternal->Type = Type;
+ NewExternal->Value = Value;
+ NewExternal->Resolved = Resolved;
+ NewExternal->Length = (UINT16) ACPI_STRLEN (Path);
+ NewExternal->InternalPath = InternalPath;
+
+ /* Set flag to indicate External->InternalPath needs to be freed */
+
+ NewExternal->Flags |= ACPI_IPATH_ALLOCATED | ACPI_FROM_REFERENCE_FILE;
+
+ /* Link the new descriptor into the global list, alphabetically ordered */
+
+ NextExternal = AcpiGbl_ExternalList;
+ while (NextExternal)
+ {
+ if (AcpiUtStricmp (NewExternal->Path, NextExternal->Path) < 0)
+ {
+ if (PrevExternal)
+ {
+ PrevExternal->Next = NewExternal;
+ }
+ else
+ {
+ AcpiGbl_ExternalList = NewExternal;
+ }
+
+ NewExternal->Next = NextExternal;
+ return;
+ }
+
+ PrevExternal = NextExternal;
+ NextExternal = NextExternal->Next;
+ }
+
+ if (PrevExternal)
+ {
+ PrevExternal->Next = NewExternal;
+ }
+ else
+ {
+ AcpiGbl_ExternalList = NewExternal;
+ }
+}
+
+
+/*******************************************************************************
+ *
* FUNCTION: AcpiDmAddExternalsToNamespace
*
* PARAMETERS: None
@@ -635,7 +907,7 @@ AcpiDmAddExternalsToNamespace (
Status = AcpiNsLookup (NULL, External->InternalPath, External->Type,
ACPI_IMODE_LOAD_PASS1,
- ACPI_NS_EXTERNAL | ACPI_NS_DONT_OPEN_SCOPE,
+ ACPI_NS_ERROR_IF_FOUND | ACPI_NS_EXTERNAL | ACPI_NS_DONT_OPEN_SCOPE,
NULL, &Node);
if (ACPI_FAILURE (Status))
@@ -803,7 +1075,8 @@ AcpiDmEmitExternals (
NextExternal->Path,
AcpiDmGetObjectTypeName (NextExternal->Type));
- AcpiOsPrintf (") // Warning: Unresolved Method, "
+ AcpiOsPrintf (
+ ") // Warning: Unresolved Method, "
"guessing %u arguments (may be incorrect, see warning above)\n",
NextExternal->Value);
@@ -815,9 +1088,45 @@ AcpiDmEmitExternals (
AcpiOsPrintf ("\n");
+
+ /* Emit externals that were imported from a file */
+
+ if (Gbl_ExternalRefFilename)
+ {
+ AcpiOsPrintf (
+ " /*\n * External declarations that were imported from\n"
+ " * the reference file [%s]\n */\n",
+ Gbl_ExternalRefFilename);
+
+ NextExternal = AcpiGbl_ExternalList;
+ while (NextExternal)
+ {
+ if (!NextExternal->Emitted && (NextExternal->Flags & ACPI_FROM_REFERENCE_FILE))
+ {
+ AcpiOsPrintf (" External (%s%s",
+ NextExternal->Path,
+ AcpiDmGetObjectTypeName (NextExternal->Type));
+
+ if (NextExternal->Type == ACPI_TYPE_METHOD)
+ {
+ AcpiOsPrintf (") // %u Arguments\n",
+ NextExternal->Value);
+ }
+ else
+ {
+ AcpiOsPrintf (")\n");
+ }
+ NextExternal->Emitted = TRUE;
+ }
+
+ NextExternal = NextExternal->Next;
+ }
+
+ AcpiOsPrintf ("\n");
+ }
+
/*
- * Walk the list of externals (unresolved references)
- * found during the AML parsing
+ * Walk the list of externals found during the AML parsing
*/
while (AcpiGbl_ExternalList)
{
diff --git a/src/acpica/source/common/dmtable.c b/src/acpica/source/common/dmtable.c
index b1f2e77..fa7b300 100644
--- a/src/acpica/source/common/dmtable.c
+++ b/src/acpica/source/common/dmtable.c
@@ -518,7 +518,7 @@ AcpiDmDumpDataTable (
Length = Table->Length;
AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoFacs);
}
- else if (ACPI_COMPARE_NAME (Table->Signature, ACPI_SIG_RSDP))
+ else if (ACPI_VALIDATE_RSDP_SIG (Table->Signature))
{
Length = AcpiDmDumpRsdp (Table);
}
diff --git a/src/acpica/source/compiler/aslcompile.c b/src/acpica/source/compiler/aslcompile.c
index 3d5a1a5..b0c1ab6 100644
--- a/src/acpica/source/compiler/aslcompile.c
+++ b/src/acpica/source/compiler/aslcompile.c
@@ -665,10 +665,15 @@ CmDoCompile (
AslCompilerparse();
UtEndEvent (Event);
- /* Flush out any remaining source after parse tree is complete */
+ /* Check for parse errors */
- Event = UtBeginEvent ("Flush source input");
- CmFlushSourceCode ();
+ Status = AslCheckForErrorExit ();
+ if (ACPI_FAILURE (Status))
+ {
+ fprintf (stderr, "Compiler aborting due to parser-detected syntax error(s)\n");
+ LsDumpParseTree ();
+ goto ErrorExit;
+ }
/* Did the parse tree get successfully constructed? */
@@ -678,16 +683,18 @@ CmDoCompile (
* If there are no errors, then we have some sort of
* internal problem.
*/
- Status = AslCheckForErrorExit ();
- if (Status == AE_OK)
- {
- AslError (ASL_ERROR, ASL_MSG_COMPILER_INTERNAL,
- NULL, "- Could not resolve parse tree root node");
- }
+ AslError (ASL_ERROR, ASL_MSG_COMPILER_INTERNAL,
+ NULL, "- Could not resolve parse tree root node");
goto ErrorExit;
}
+
+ /* Flush out any remaining source after parse tree is complete */
+
+ Event = UtBeginEvent ("Flush source input");
+ CmFlushSourceCode ();
+
/* Optional parse tree dump, compiler debug output only */
LsDumpParseTree ();
diff --git a/src/acpica/source/compiler/aslcompiler.h b/src/acpica/source/compiler/aslcompiler.h
index 19539a5..b90d20c 100644
--- a/src/acpica/source/compiler/aslcompiler.h
+++ b/src/acpica/source/compiler/aslcompiler.h
@@ -195,11 +195,6 @@ ACPI_STATUS (*ASL_PATHNAME_CALLBACK) (
char *);
ACPI_STATUS
-AslDoOnePathname (
- char *Pathname,
- ASL_PATHNAME_CALLBACK Callback);
-
-ACPI_STATUS
AslDoOneFile (
char *Filename);
diff --git a/src/acpica/source/compiler/aslerror.c b/src/acpica/source/compiler/aslerror.c
index 8863026..6439977 100644
--- a/src/acpica/source/compiler/aslerror.c
+++ b/src/acpica/source/compiler/aslerror.c
@@ -683,7 +683,6 @@ AslCommonError (
char *Filename,
char *ExtraMessage)
{
- UINT32 MessageSize;
char *MessageBuffer = NULL;
ASL_ERROR_MSG *Enode;
@@ -694,8 +693,7 @@ AslCommonError (
{
/* Allocate a buffer for the message and a new error node */
- MessageSize = strlen (ExtraMessage) + 1;
- MessageBuffer = UtLocalCalloc (MessageSize);
+ MessageBuffer = UtLocalCalloc (strlen (ExtraMessage) + 1);
/* Keep a copy of the extra message */
diff --git a/src/acpica/source/compiler/aslglobal.h b/src/acpica/source/compiler/aslglobal.h
index 5468711..7fb67c9 100644
--- a/src/acpica/source/compiler/aslglobal.h
+++ b/src/acpica/source/compiler/aslglobal.h
@@ -258,6 +258,7 @@ ASL_EXTERN char ASL_INIT_GLOBAL (*Gbl_IncludeFilename, NULL)
ASL_EXTERN char ASL_INIT_GLOBAL (*Gbl_OutputFilenamePrefix, NULL);
ASL_EXTERN ASL_INCLUDE_DIR ASL_INIT_GLOBAL (*Gbl_IncludeDirList, NULL);
ASL_EXTERN char *Gbl_CurrentInputFilename;
+ASL_EXTERN char ASL_INIT_GLOBAL (*Gbl_ExternalRefFilename, NULL);
ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_HasIncludeFiles, FALSE);
diff --git a/src/acpica/source/compiler/aslmain.c b/src/acpica/source/compiler/aslmain.c
index 3a0f750..bc6b658 100644
--- a/src/acpica/source/compiler/aslmain.c
+++ b/src/acpica/source/compiler/aslmain.c
@@ -123,6 +123,17 @@
#define _COMPONENT ACPI_COMPILER
ACPI_MODULE_NAME ("aslmain")
+/*
+ * Main routine for the iASL compiler.
+ *
+ * Portability note: The compiler depends upon the host for command-line
+ * wildcard support - it is not implemented locally. For example:
+ *
+ * Linux/Unix systems: Shell expands wildcards automatically.
+ *
+ * Windows: The setargv.obj module must be linked in to automatically
+ * expand wildcards.
+ */
/* Local prototypes */
@@ -203,13 +214,14 @@ Usage (
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 ("-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 ("-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 ("-dc <f1 f2 ...>", "Disassemble AML and immediately compile it");
ACPI_OPTION ("", " (Obtain DSDT from current system if no input file)");
- ACPI_OPTION ("-e <f1,f2>", "Include ACPI table(s) for external symbol resolution");
+ ACPI_OPTION ("-e <f1 f2 ...>", "Include ACPI table(s) for external symbol resolution");
+ ACPI_OPTION ("-fe <file>", "Specify external symbol declaration file");
ACPI_OPTION ("-g", "Get ACPI tables and write to files (*.dat)");
ACPI_OPTION ("-in", "Ignore NoOp opcodes");
ACPI_OPTION ("-vt", "Dump binary table data in hex format within output file");
@@ -392,7 +404,7 @@ main (
{
while (argv[Index1])
{
- Status = AslDoOnePathname (argv[Index1], AcpiDmAddToExternalFileList);
+ Status = AcpiDmAddToExternalFileList (argv[Index1]);
if (ACPI_FAILURE (Status))
{
return (-1);
@@ -406,7 +418,16 @@ main (
while (argv[Index2])
{
- Status = AslDoOnePathname (argv[Index2], AslDoOneFile);
+ /*
+ * If -p not specified, we will use the input filename as the
+ * output filename prefix
+ */
+ if (Gbl_UseDefaultAmlFilename)
+ {
+ Gbl_OutputFilenamePrefix = argv[Index2];
+ }
+
+ Status = AslDoOneFile (argv[Index2]);
if (ACPI_FAILURE (Status))
{
return (-1);
diff --git a/src/acpica/source/compiler/aslstartup.c b/src/acpica/source/compiler/aslstartup.c
index 19b4f95..73e1b8f 100644
--- a/src/acpica/source/compiler/aslstartup.c
+++ b/src/acpica/source/compiler/aslstartup.c
@@ -123,18 +123,8 @@
ACPI_MODULE_NAME ("aslstartup")
-#define ASL_MAX_FILES 256
-static char *FileList[ASL_MAX_FILES];
-static BOOLEAN AslToFile = TRUE;
-
-
/* Local prototypes */
-static char **
-AsDoWildcard (
- char *DirectoryPathname,
- char *FileSpecifier);
-
static UINT8
AslDetectSourceFileType (
ASL_FILE_INFO *Info);
@@ -144,6 +134,11 @@ AslDoDisassembly (
void);
+/* Globals */
+
+static BOOLEAN AslToFile = TRUE;
+
+
/*******************************************************************************
*
* FUNCTION: AslInitializeGlobals
@@ -203,82 +198,6 @@ AslInitializeGlobals (
}
-/******************************************************************************
- *
- * FUNCTION: AsDoWildcard
- *
- * PARAMETERS: None
- *
- * RETURN: None
- *
- * DESCRIPTION: Process files via wildcards. This function is for the Windows
- * case only.
- *
- ******************************************************************************/
-
-static char **
-AsDoWildcard (
- char *DirectoryPathname,
- char *FileSpecifier)
-{
-#ifdef WIN32
- void *DirInfo;
- char *Filename;
- int FileCount;
-
-
- FileCount = 0;
-
- /* Open parent directory */
-
- DirInfo = AcpiOsOpenDirectory (DirectoryPathname, FileSpecifier, REQUEST_FILE_ONLY);
- if (!DirInfo)
- {
- /* Either the directory of file does not exist */
-
- Gbl_Files[ASL_FILE_INPUT].Filename = FileSpecifier;
- FlFileError (ASL_FILE_INPUT, ASL_MSG_OPEN);
- AslAbort ();
- }
-
- /* Process each file that matches the wildcard specification */
-
- while ((Filename = AcpiOsGetNextFilename (DirInfo)))
- {
- /* Add the filename to the file list */
-
- FileList[FileCount] = AcpiOsAllocate (strlen (Filename) + 1);
- strcpy (FileList[FileCount], Filename);
- FileCount++;
-
- if (FileCount >= ASL_MAX_FILES)
- {
- printf ("Max files reached\n");
- FileList[0] = NULL;
- return (FileList);
- }
- }
-
- /* Cleanup */
-
- AcpiOsCloseDirectory (DirInfo);
- FileList[FileCount] = NULL;
- return (FileList);
-
-#else
- /*
- * Linux/Unix cases - Wildcards are expanded by the shell automatically.
- * Just return the filename in a null terminated list
- */
- FileList[0] = AcpiOsAllocate (strlen (FileSpecifier) + 1);
- strcpy (FileList[0], FileSpecifier);
- FileList[1] = NULL;
-
- return (FileList);
-#endif
-}
-
-
/*******************************************************************************
*
* FUNCTION: AslDetectSourceFileType
@@ -467,6 +386,17 @@ AslDoOneFile (
AslInitializeGlobals ();
PrInitializeGlobals ();
+ /*
+ * Extract the directory path. This path is used for possible include
+ * files and the optional AML filename embedded in the input file
+ * DefinitionBlock declaration.
+ */
+ Status = FlSplitInputPathname (Filename, &Gbl_DirectoryPath, NULL);
+ if (ACPI_FAILURE (Status))
+ {
+ return (Status);
+ }
+
Gbl_Files[ASL_FILE_INPUT].Filename = Filename;
/*
@@ -615,77 +545,6 @@ AslDoOneFile (
/*******************************************************************************
*
- * FUNCTION: AslDoOnePathname
- *
- * PARAMETERS: Pathname - Full pathname, possibly with wildcards
- *
- * RETURN: Status
- *
- * DESCRIPTION: Process one pathname, possible terminated with a wildcard
- * specification. If a wildcard, it is expanded and the multiple
- * files are processed.
- *
- ******************************************************************************/
-
-ACPI_STATUS
-AslDoOnePathname (
- char *Pathname,
- ASL_PATHNAME_CALLBACK PathCallback)
-{
- ACPI_STATUS Status = AE_OK;
- char **WildcardList;
- char *Filename;
- char *FullPathname;
-
-
- /* Split incoming path into a directory/filename combo */
-
- Status = FlSplitInputPathname (Pathname, &Gbl_DirectoryPath, &Filename);
- if (ACPI_FAILURE (Status))
- {
- return (Status);
- }
-
- /* Expand possible wildcard into a file list (Windows/DOS only) */
-
- WildcardList = AsDoWildcard (Gbl_DirectoryPath, Filename);
- while (*WildcardList)
- {
- FullPathname = ACPI_ALLOCATE (
- strlen (Gbl_DirectoryPath) + strlen (*WildcardList) + 1);
-
- /* Construct a full path to the file */
-
- strcpy (FullPathname, Gbl_DirectoryPath);
- strcat (FullPathname, *WildcardList);
-
- /*
- * If -p not specified, we will use the input filename as the
- * output filename prefix
- */
- if (Gbl_UseDefaultAmlFilename)
- {
- Gbl_OutputFilenamePrefix = FullPathname;
- }
-
- /* Save status from all compiles */
-
- Status |= (*PathCallback) (FullPathname);
-
- ACPI_FREE (FullPathname);
- ACPI_FREE (*WildcardList);
- *WildcardList = NULL;
- WildcardList++;
- }
-
- ACPI_FREE (Gbl_DirectoryPath);
- ACPI_FREE (Filename);
- return (Status);
-}
-
-
-/*******************************************************************************
- *
* FUNCTION: AslCheckForErrorExit
*
* PARAMETERS: None. Examines global exception count array
diff --git a/src/acpica/source/compiler/dtcompile.c b/src/acpica/source/compiler/dtcompile.c
index ae33948..099018b 100644
--- a/src/acpica/source/compiler/dtcompile.c
+++ b/src/acpica/source/compiler/dtcompile.c
@@ -389,7 +389,7 @@ DtCompileDataTable (
DtSetTableLength ();
return (Status);
}
- else if (ACPI_COMPARE_NAME (Signature, ACPI_SIG_RSDP))
+ else if (ACPI_VALIDATE_RSDP_SIG (Signature))
{
Status = DtCompileRsdp (FieldList);
return (Status);
diff --git a/src/acpica/source/compiler/fwts_iasl_interface.c b/src/acpica/source/compiler/fwts_iasl_interface.c
index 206e0c8..49278ec 100644
--- a/src/acpica/source/compiler/fwts_iasl_interface.c
+++ b/src/acpica/source/compiler/fwts_iasl_interface.c
@@ -70,7 +70,7 @@ int fwts_iasl_disassemble_aml(const char *aml, const char *outputfile)
/* Throw away noisy errors */
if (freopen("/dev/null", "w", stderr) != NULL)
- (void)AslDoOnePathname((char *)aml, AslDoOneFile);
+ AslDoOneFile((char *)aml);
_exit(0);
break;
@@ -122,7 +122,7 @@ int fwts_iasl_assemble_aml(const char *source, char **output)
Gbl_UseDefaultAmlFilename = FALSE;
Gbl_OutputFilenamePrefix = (char*)source;
- (void)AslDoOnePathname((char*)source, AslDoOneFile);
+ (void)AslDoOneFile((char *)source);
/*
* We need to flush buffered I/O on IASL stdout
diff --git a/src/acpica/source/components/debugger/dbcmds.c b/src/acpica/source/components/debugger/dbcmds.c
index 54ddf1a..aa3f89b 100644
--- a/src/acpica/source/components/debugger/dbcmds.c
+++ b/src/acpica/source/components/debugger/dbcmds.c
@@ -1283,6 +1283,14 @@ AcpiDbGenerateGpe (
(void) AcpiEvGpeDispatch (NULL, GpeEventInfo, GpeNumber);
}
+
+void
+AcpiDbGenerateSci (
+ void)
+{
+ AcpiEvSciDispatch ();
+}
+
#endif /* !ACPI_REDUCED_HARDWARE */
#endif /* ACPI_DEBUGGER */
diff --git a/src/acpica/source/components/debugger/dbexec.c b/src/acpica/source/components/debugger/dbexec.c
index cbe752b..769eb29 100644
--- a/src/acpica/source/components/debugger/dbexec.c
+++ b/src/acpica/source/components/debugger/dbexec.c
@@ -134,7 +134,7 @@ AcpiDbExecuteMethod (
ACPI_DB_METHOD_INFO *Info,
ACPI_BUFFER *ReturnObj);
-static void
+static ACPI_STATUS
AcpiDbExecuteSetup (
ACPI_DB_METHOD_INFO *Info);
@@ -309,10 +309,15 @@ Cleanup:
*
******************************************************************************/
-static void
+static ACPI_STATUS
AcpiDbExecuteSetup (
ACPI_DB_METHOD_INFO *Info)
{
+ ACPI_STATUS Status;
+
+
+ ACPI_FUNCTION_NAME (DbExecuteSetup);
+
/* Catenate the current scope to the supplied name */
@@ -320,10 +325,21 @@ AcpiDbExecuteSetup (
if ((Info->Name[0] != '\\') &&
(Info->Name[0] != '/'))
{
- ACPI_STRCAT (Info->Pathname, AcpiGbl_DbScopeBuf);
+ if (AcpiUtSafeStrcat (Info->Pathname, sizeof (Info->Pathname),
+ AcpiGbl_DbScopeBuf))
+ {
+ Status = AE_BUFFER_OVERFLOW;
+ goto ErrorExit;
+ }
+ }
+
+ if (AcpiUtSafeStrcat (Info->Pathname, sizeof (Info->Pathname),
+ Info->Name))
+ {
+ Status = AE_BUFFER_OVERFLOW;
+ goto ErrorExit;
}
- ACPI_STRCAT (Info->Pathname, Info->Name);
AcpiDbPrepNamestring (Info->Pathname);
AcpiDbSetOutputDestination (ACPI_DB_DUPLICATE_OUTPUT);
@@ -341,6 +357,13 @@ AcpiDbExecuteSetup (
AcpiDbSetOutputDestination (ACPI_DB_REDIRECTABLE_OUTPUT);
}
+
+ return (AE_OK);
+
+ErrorExit:
+
+ ACPI_EXCEPTION ((AE_INFO, Status, "During setup for method execution"));
+ return (Status);
}
@@ -501,7 +524,12 @@ AcpiDbExecute (
ReturnObj.Pointer = NULL;
ReturnObj.Length = ACPI_ALLOCATE_BUFFER;
- AcpiDbExecuteSetup (&AcpiGbl_DbMethodInfo);
+ Status = AcpiDbExecuteSetup (&AcpiGbl_DbMethodInfo);
+ if (ACPI_FAILURE (Status))
+ {
+ ACPI_FREE (NameString);
+ return;
+ }
/* Get the NS node, determines existence also */
@@ -801,7 +829,11 @@ AcpiDbCreateExecutionThreads (
AcpiDbUint32ToHexString (NumThreads, AcpiGbl_DbMethodInfo.NumThreadsStr);
- AcpiDbExecuteSetup (&AcpiGbl_DbMethodInfo);
+ Status = AcpiDbExecuteSetup (&AcpiGbl_DbMethodInfo);
+ if (ACPI_FAILURE (Status))
+ {
+ goto CleanupAndExit;
+ }
/* Get the NS node, determines existence also */
diff --git a/src/acpica/source/components/debugger/dbfileio.c b/src/acpica/source/components/debugger/dbfileio.c
index 768668a..1f0ae72 100644
--- a/src/acpica/source/components/debugger/dbfileio.c
+++ b/src/acpica/source/components/debugger/dbfileio.c
@@ -214,7 +214,8 @@ AcpiDbOpenDebugFile (
}
AcpiOsPrintf ("Debug output file %s opened\n", Name);
- ACPI_STRCPY (AcpiGbl_DbDebugFilename, Name);
+ ACPI_STRNCPY (AcpiGbl_DbDebugFilename, Name,
+ sizeof (AcpiGbl_DbDebugFilename));
AcpiGbl_DbOutputToFile = TRUE;
#endif
@@ -346,11 +347,9 @@ AcpiDbReadTable (
fseek (fp, 0, SEEK_SET);
- /* The RSDT, FACS and S3PT tables do not have standard ACPI headers */
+ /* The RSDP table does not have standard ACPI header */
- if (ACPI_COMPARE_NAME (TableHeader.Signature, "RSD ") ||
- ACPI_COMPARE_NAME (TableHeader.Signature, "FACS") ||
- ACPI_COMPARE_NAME (TableHeader.Signature, "S3PT"))
+ if (ACPI_COMPARE_NAME (TableHeader.Signature, "RSD "))
{
*TableLength = FileSize;
StandardHeader = FALSE;
@@ -565,7 +564,7 @@ AcpiDbReadTableFromFile (
File = fopen (Filename, "rb");
if (!File)
{
- AcpiOsPrintf ("Could not open input file %s\n", Filename);
+ perror ("Could not open input file");
return (AE_ERROR);
}
diff --git a/src/acpica/source/components/debugger/dbhistry.c b/src/acpica/source/components/debugger/dbhistry.c
index 42dab6f..8ba3c7f 100644
--- a/src/acpica/source/components/debugger/dbhistry.c
+++ b/src/acpica/source/components/debugger/dbhistry.c
@@ -141,7 +141,7 @@ static HISTORY_INFO AcpiGbl_HistoryBuffer[HISTORY_SIZE];
static UINT16 AcpiGbl_LoHistory = 0;
static UINT16 AcpiGbl_NumHistory = 0;
static UINT16 AcpiGbl_NextHistoryIndex = 0;
-static UINT32 AcpiGbl_NextCmdNum = 1;
+UINT32 AcpiGbl_NextCmdNum = 1;
/*******************************************************************************
@@ -166,6 +166,11 @@ AcpiDbAddToHistory (
/* Put command into the next available slot */
CmdLen = (UINT16) ACPI_STRLEN (CommandLine);
+ if (!CmdLen)
+ {
+ return;
+ }
+
if (AcpiGbl_HistoryBuffer[AcpiGbl_NextHistoryIndex].Command != NULL)
{
BufferLen = (UINT16) ACPI_STRLEN (
@@ -275,8 +280,6 @@ char *
AcpiDbGetFromHistory (
char *CommandNumArg)
{
- UINT32 i;
- UINT16 HistoryIndex;
UINT32 CmdNum;
@@ -290,6 +293,31 @@ AcpiDbGetFromHistory (
CmdNum = ACPI_STRTOUL (CommandNumArg, NULL, 0);
}
+ return (AcpiDbGetHistoryByIndex (CmdNum));
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDbGetHistoryByIndex
+ *
+ * PARAMETERS: CmdNum - Index of the desired history entry.
+ * Values are 0...(AcpiGbl_NextCmdNum - 1)
+ *
+ * RETURN: Pointer to the retrieved command. Null on error.
+ *
+ * DESCRIPTION: Get a command from the history buffer
+ *
+ ******************************************************************************/
+
+char *
+AcpiDbGetHistoryByIndex (
+ UINT32 CmdNum)
+{
+ UINT32 i;
+ UINT16 HistoryIndex;
+
+
/* Search history buffer */
HistoryIndex = AcpiGbl_LoHistory;
@@ -302,6 +330,7 @@ AcpiDbGetFromHistory (
return (AcpiGbl_HistoryBuffer[HistoryIndex].Command);
}
+ /* History buffer is circular */
HistoryIndex++;
if (HistoryIndex >= HISTORY_SIZE)
diff --git a/src/acpica/source/components/debugger/dbinput.c b/src/acpica/source/components/debugger/dbinput.c
index 2f6127f..91f4e62 100644
--- a/src/acpica/source/components/debugger/dbinput.c
+++ b/src/acpica/source/components/debugger/dbinput.c
@@ -204,12 +204,14 @@ enum AcpiExDebuggerCommands
CMD_OPEN,
CMD_OSI,
CMD_OWNER,
+ CMD_PATHS,
CMD_PREDEFINED,
CMD_PREFIX,
CMD_QUIT,
CMD_REFERENCES,
CMD_RESOURCES,
CMD_RESULTS,
+ CMD_SCI,
CMD_SET,
CMD_SLEEP,
CMD_STATS,
@@ -275,12 +277,14 @@ static const ACPI_DB_COMMAND_INFO AcpiGbl_DbCommands[] =
{"OPEN", 1},
{"OSI", 0},
{"OWNER", 1},
+ {"PATHS", 0},
{"PREDEFINED", 0},
{"PREFIX", 0},
{"QUIT", 0},
{"REFERENCES", 1},
{"RESOURCES", 0},
{"RESULTS", 0},
+ {"SCI", 0},
{"SET", 3},
{"SLEEP", 0},
{"STATS", 1},
@@ -331,22 +335,19 @@ static const ACPI_DB_COMMAND_HELP AcpiGbl_DbCommandHelp[] =
{0, "\nNamespace Access Commands:", "\n"},
{1, " Businfo", "Display system bus info\n"},
{1, " Disassemble <Method>", "Disassemble a control method\n"},
- {1, " Event <F|G> <Value>", "Generate AcpiEvent (Fixed/GPE)\n"},
{1, " Find <AcpiName> (? is wildcard)", "Find ACPI name(s) with wildcards\n"},
- {1, " Gpe <GpeNum> <GpeBlock>", "Simulate a GPE\n"},
- {1, " Gpes", "Display info on all GPEs\n"},
{1, " Integrity", "Validate namespace integrity\n"},
{1, " Methods", "Display list of loaded control methods\n"},
{1, " Namespace [Object] [Depth]", "Display loaded namespace tree/subtree\n"},
{1, " Notify <Object> <Value>", "Send a notification on Object\n"},
{1, " Objects <ObjectType>", "Display all objects of the given type\n"},
{1, " Owner <OwnerId> [Depth]", "Display loaded namespace by object owner\n"},
+ {1, " Paths", "Display full pathnames of namespace objects\n"},
{1, " Predefined", "Check all predefined names\n"},
{1, " Prefix [<NamePath>]", "Set or Get current execution prefix\n"},
{1, " References <Addr>", "Find all references to object at addr\n"},
{1, " Resources [DeviceName]", "Display Device resources (no arg = all devices)\n"},
{1, " Set N <NamedObject> <Value>", "Set value for named integer\n"},
- {1, " Sleep [SleepState]", "Simulate sleep/wake sequence(s) (0-5)\n"},
{1, " Template <Object>", "Format/dump a Buffer/ResourceTemplate\n"},
{1, " Terminate", "Delete namespace and all internal objects\n"},
{1, " Type <Object>", "Display object type\n"},
@@ -360,7 +361,7 @@ static const ACPI_DB_COMMAND_HELP AcpiGbl_DbCommandHelp[] =
{5, " Execute <Namepath> [Arguments]", "Execute control method\n"},
{1, " Hex Integer", "Integer method argument\n"},
{1, " \"Ascii String\"", "String method argument\n"},
- {1, " (Byte List)", "Buffer method argument\n"},
+ {1, " (Hex Byte List)", "Buffer method argument\n"},
{1, " [Package Element List]", "Package method argument\n"},
{1, " Go", "Allow method to run to completion\n"},
{1, " Information", "Display info about the current method\n"},
@@ -375,6 +376,13 @@ static const ACPI_DB_COMMAND_HELP AcpiGbl_DbCommandHelp[] =
{1, " Tree", "Display control method calling tree\n"},
{1, " <Enter>", "Single step next AML opcode (over calls)\n"},
+ {0, "\nHardware Related Commands:", "\n"},
+ {1, " Event <F|G> <Value>", "Generate AcpiEvent (Fixed/GPE)\n"},
+ {1, " Gpe <GpeNum> <GpeBlock>", "Simulate a GPE\n"},
+ {1, " Gpes", "Display info on all GPEs\n"},
+ {1, " Sci", "Generate an SCI\n"},
+ {1, " Sleep [SleepState]", "Simulate sleep/wake sequence(s) (0-5)\n"},
+
{0, "\nFile I/O Commands:", "\n"},
{1, " Close", "Close debug output file\n"},
{1, " Load <Input Filename>", "Load ACPI table from a file\n"},
@@ -699,7 +707,13 @@ AcpiDbGetLine (
char *This;
- ACPI_STRCPY (AcpiGbl_DbParsedBuf, InputBuffer);
+ if (AcpiUtSafeStrcpy (AcpiGbl_DbParsedBuf, sizeof (AcpiGbl_DbParsedBuf),
+ InputBuffer))
+ {
+ AcpiOsPrintf ("Buffer overflow while parsing input line (max %u characters)\n",
+ sizeof (AcpiGbl_DbParsedBuf));
+ return (0);
+ }
This = AcpiGbl_DbParsedBuf;
for (i = 0; i < ACPI_DEBUGGER_MAX_ARGS; i++)
@@ -804,6 +818,11 @@ AcpiDbCommandDispatch (
return (AE_CTRL_TERMINATE);
}
+
+ /* Add all commands that come here to the history buffer */
+
+ AcpiDbAddToHistory (InputBuffer);
+
ParamCount = AcpiDbGetLine (InputBuffer);
CommandIndex = AcpiDbMatchCommand (AcpiGbl_DbArgs[0]);
Temp = 0;
@@ -1074,6 +1093,11 @@ AcpiDbCommandDispatch (
AcpiDbDumpNamespaceByOwner (AcpiGbl_DbArgs[1], AcpiGbl_DbArgs[2]);
break;
+ case CMD_PATHS:
+
+ AcpiDbDumpNamespacePaths ();
+ break;
+
case CMD_PREDEFINED:
AcpiDbCheckPredefinedNames ();
@@ -1099,6 +1123,11 @@ AcpiDbCommandDispatch (
AcpiDbDisplayResults ();
break;
+ case CMD_SCI:
+
+ AcpiDbGenerateSci ();
+ break;
+
case CMD_SET:
AcpiDbSetMethodData (AcpiGbl_DbArgs[1], AcpiGbl_DbArgs[2],
@@ -1189,7 +1218,7 @@ AcpiDbCommandDispatch (
case CMD_NOT_FOUND:
default:
- AcpiOsPrintf ("Unknown Command\n");
+ AcpiOsPrintf ("%s: unknown command\n", AcpiGbl_DbArgs[0]);
return (AE_CTRL_TRUE);
}
@@ -1198,9 +1227,6 @@ AcpiDbCommandDispatch (
Status = AE_CTRL_TRUE;
}
- /* Add all commands that come here to the history buffer */
-
- AcpiDbAddToHistory (InputBuffer);
return (Status);
}
diff --git a/src/acpica/source/components/debugger/dbnames.c b/src/acpica/source/components/debugger/dbnames.c
index 9fbe539..d7d66a3 100644
--- a/src/acpica/source/components/debugger/dbnames.c
+++ b/src/acpica/source/components/debugger/dbnames.c
@@ -243,8 +243,7 @@ AcpiDbSetScope (
goto ErrorExit;
}
- ACPI_STRCPY (AcpiGbl_DbScopeBuf, Name);
- ACPI_STRCAT (AcpiGbl_DbScopeBuf, "\\");
+ AcpiGbl_DbScopeBuf[0] = 0;
}
else
{
@@ -256,9 +255,22 @@ AcpiDbSetScope (
{
goto ErrorExit;
}
+ }
+
+ /* Build the final pathname */
+
+ if (AcpiUtSafeStrcat (AcpiGbl_DbScopeBuf, sizeof (AcpiGbl_DbScopeBuf),
+ Name))
+ {
+ Status = AE_BUFFER_OVERFLOW;
+ goto ErrorExit;
+ }
- ACPI_STRCAT (AcpiGbl_DbScopeBuf, Name);
- ACPI_STRCAT (AcpiGbl_DbScopeBuf, "\\");
+ if (AcpiUtSafeStrcat (AcpiGbl_DbScopeBuf, sizeof (AcpiGbl_DbScopeBuf),
+ "\\"))
+ {
+ Status = AE_BUFFER_OVERFLOW;
+ goto ErrorExit;
}
AcpiGbl_DbScopeNode = Node;
@@ -328,6 +340,37 @@ AcpiDbDumpNamespace (
/*******************************************************************************
*
+ * FUNCTION: AcpiDbDumpNamespacePaths
+ *
+ * PARAMETERS: None
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Dump entire namespace with full object pathnames and object
+ * type information. Alternative to "namespace" command.
+ *
+ ******************************************************************************/
+
+void
+AcpiDbDumpNamespacePaths (
+ void)
+{
+
+ AcpiDbSetOutputDestination (ACPI_DB_DUPLICATE_OUTPUT);
+ AcpiOsPrintf ("ACPI Namespace (from root):\n");
+
+ /* Display the entire namespace */
+
+ AcpiDbSetOutputDestination (ACPI_DB_REDIRECTABLE_OUTPUT);
+ AcpiNsDumpObjectPaths (ACPI_TYPE_ANY, ACPI_DISPLAY_SUMMARY,
+ ACPI_UINT32_MAX, ACPI_OWNER_ID_MAX, AcpiGbl_RootNode);
+
+ AcpiDbSetOutputDestination (ACPI_DB_CONSOLE_OUTPUT);
+}
+
+
+/*******************************************************************************
+ *
* FUNCTION: AcpiDbDumpNamespaceByOwner
*
* PARAMETERS: OwnerArg - Owner ID whose nodes will be displayed
diff --git a/src/acpica/source/components/debugger/dbxface.c b/src/acpica/source/components/debugger/dbxface.c
index a0e9641..845d75f 100644
--- a/src/acpica/source/components/debugger/dbxface.c
+++ b/src/acpica/source/components/debugger/dbxface.c
@@ -579,6 +579,10 @@ AcpiDbTerminate (
AcpiOsFree (AcpiGbl_DbBuffer);
AcpiGbl_DbBuffer = NULL;
}
+
+ /* Ensure that debug output is now disabled */
+
+ AcpiGbl_DbOutputFlags = ACPI_DB_DISABLE_OUTPUT;
}
diff --git a/src/acpica/source/components/events/evgpe.c b/src/acpica/source/components/events/evgpe.c
index 64c1167..0eceb5e 100644
--- a/src/acpica/source/components/events/evgpe.c
+++ b/src/acpica/source/components/events/evgpe.c
@@ -621,6 +621,7 @@ AcpiEvAsynchExecuteGpeMethod (
Status = AcpiUtAcquireMutex (ACPI_MTX_EVENTS);
if (ACPI_FAILURE (Status))
{
+ ACPI_FREE (LocalGpeEventInfo);
return_VOID;
}
@@ -629,6 +630,7 @@ AcpiEvAsynchExecuteGpeMethod (
if (!AcpiEvValidGpeEvent (GpeEventInfo))
{
Status = AcpiUtReleaseMutex (ACPI_MTX_EVENTS);
+ ACPI_FREE (LocalGpeEventInfo);
return_VOID;
}
@@ -642,6 +644,7 @@ AcpiEvAsynchExecuteGpeMethod (
Status = AcpiUtReleaseMutex (ACPI_MTX_EVENTS);
if (ACPI_FAILURE (Status))
{
+ ACPI_FREE (LocalGpeEventInfo);
return_VOID;
}
diff --git a/src/acpica/source/components/events/evgpeutil.c b/src/acpica/source/components/events/evgpeutil.c
index eb008dc..fd0d717 100644
--- a/src/acpica/source/components/events/evgpeutil.c
+++ b/src/acpica/source/components/events/evgpeutil.c
@@ -288,7 +288,7 @@ AcpiEvGetGpeDevice (
*
* FUNCTION: AcpiEvGetGpeXruptBlock
*
- * PARAMETERS: InterruptNumber - Interrupt for a GPE block
+ * PARAMETERS: InterruptNumber - Interrupt for a GPE block
*
* RETURN: A GPE interrupt block
*
diff --git a/src/acpica/source/components/events/evmisc.c b/src/acpica/source/components/events/evmisc.c
index 9e871fb..b0c8983 100644
--- a/src/acpica/source/components/events/evmisc.c
+++ b/src/acpica/source/components/events/evmisc.c
@@ -364,15 +364,6 @@ AcpiEvTerminate (
Status = AcpiEvWalkGpeList (AcpiHwDisableGpeBlock, NULL);
- /* Remove SCI handler */
-
- Status = AcpiEvRemoveSciHandler ();
- if (ACPI_FAILURE(Status))
- {
- ACPI_ERROR ((AE_INFO,
- "Could not remove SCI handler"));
- }
-
Status = AcpiEvRemoveGlobalLockHandler ();
if (ACPI_FAILURE(Status))
{
@@ -383,6 +374,15 @@ AcpiEvTerminate (
AcpiGbl_EventsInitialized = FALSE;
}
+ /* Remove SCI handlers */
+
+ Status = AcpiEvRemoveAllSciHandlers ();
+ if (ACPI_FAILURE(Status))
+ {
+ ACPI_ERROR ((AE_INFO,
+ "Could not remove SCI handler"));
+ }
+
/* Deallocate all handler objects installed within GPE info structs */
Status = AcpiEvWalkGpeList (AcpiEvDeleteGpeHandlers, NULL);
diff --git a/src/acpica/source/components/events/evregion.c b/src/acpica/source/components/events/evregion.c
index a8a24d5..efaf38b 100644
--- a/src/acpica/source/components/events/evregion.c
+++ b/src/acpica/source/components/events/evregion.c
@@ -306,18 +306,12 @@ AcpiEvAddressSpaceDispatch (
{
RegionObj->Region.Flags |= AOPOBJ_SETUP_COMPLETE;
- if (RegionObj2->Extra.RegionContext)
- {
- /* The handler for this region was already installed */
-
- ACPI_FREE (RegionContext);
- }
- else
+ /*
+ * Save the returned context for use in all accesses to
+ * the handler for this particular region
+ */
+ if (!(RegionObj2->Extra.RegionContext))
{
- /*
- * Save the returned context for use in all accesses to
- * this particular region
- */
RegionObj2->Extra.RegionContext = RegionContext;
}
}
@@ -333,7 +327,6 @@ AcpiEvAddressSpaceDispatch (
ACPI_FORMAT_NATIVE_UINT (RegionObj->Region.Address + RegionOffset),
AcpiUtGetRegionName (RegionObj->Region.SpaceId)));
-
/*
* Special handling for GenericSerialBus and GeneralPurposeIo:
* There are three extra parameters that must be passed to the
@@ -496,6 +489,15 @@ AcpiEvDetachRegion(
Status = RegionSetup (RegionObj, ACPI_REGION_DEACTIVATE,
HandlerObj->AddressSpace.Context, RegionContext);
+ /*
+ * RegionContext should have been released by the deactivate
+ * operation. We don't need access to it anymore here.
+ */
+ if (RegionContext)
+ {
+ *RegionContext = NULL;
+ }
+
/* Init routine may fail, Just ignore errors */
if (ACPI_FAILURE (Status))
diff --git a/src/acpica/source/components/events/evsci.c b/src/acpica/source/components/events/evsci.c
index 5493bff..fe5c309 100644
--- a/src/acpica/source/components/events/evsci.c
+++ b/src/acpica/source/components/events/evsci.c
@@ -134,6 +134,57 @@ AcpiEvSciXruptHandler (
/*******************************************************************************
*
+ * FUNCTION: AcpiEvSciDispatch
+ *
+ * PARAMETERS: None
+ *
+ * RETURN: Status code indicates whether interrupt was handled.
+ *
+ * DESCRIPTION: Dispatch the SCI to all host-installed SCI handlers.
+ *
+ ******************************************************************************/
+
+UINT32
+AcpiEvSciDispatch (
+ void)
+{
+ ACPI_SCI_HANDLER_INFO *SciHandler;
+ ACPI_CPU_FLAGS Flags;
+ UINT32 IntStatus = ACPI_INTERRUPT_NOT_HANDLED;
+
+
+ ACPI_FUNCTION_NAME (EvSciDispatch);
+
+
+ /* Are there any host-installed SCI handlers? */
+
+ if (!AcpiGbl_SciHandlerList)
+ {
+ return (IntStatus);
+ }
+
+ Flags = AcpiOsAcquireLock (AcpiGbl_GpeLock);
+
+ /* Invoke all host-installed SCI handlers */
+
+ SciHandler = AcpiGbl_SciHandlerList;
+ while (SciHandler)
+ {
+ /* Invoke the installed handler (at interrupt level) */
+
+ IntStatus |= SciHandler->Address (
+ SciHandler->Context);
+
+ SciHandler = SciHandler->Next;
+ }
+
+ AcpiOsReleaseLock (AcpiGbl_GpeLock, Flags);
+ return (IntStatus);
+}
+
+
+/*******************************************************************************
+ *
* FUNCTION: AcpiEvSciXruptHandler
*
* PARAMETERS: Context - Calling Context
@@ -173,6 +224,10 @@ AcpiEvSciXruptHandler (
*/
InterruptHandled |= AcpiEvGpeDetect (GpeXruptList);
+ /* Invoke all host-installed SCI handlers */
+
+ InterruptHandled |= AcpiEvSciDispatch ();
+
AcpiSciCount++;
return_UINT32 (InterruptHandled);
}
@@ -202,14 +257,13 @@ AcpiEvGpeXruptHandler (
/*
- * We are guaranteed by the ACPI CA initialization/shutdown code that
+ * We are guaranteed by the ACPICA initialization/shutdown code that
* if this interrupt handler is installed, ACPI is enabled.
*/
/* GPEs: Check for and dispatch any GPEs that have occurred */
InterruptHandled |= AcpiEvGpeDetect (GpeXruptList);
-
return_UINT32 (InterruptHandled);
}
@@ -244,15 +298,15 @@ AcpiEvInstallSciHandler (
/******************************************************************************
*
- * FUNCTION: AcpiEvRemoveSciHandler
+ * FUNCTION: AcpiEvRemoveAllSciHandlers
*
* PARAMETERS: none
*
- * RETURN: E_OK if handler uninstalled OK, E_ERROR if handler was not
+ * RETURN: AE_OK if handler uninstalled, AE_ERROR if handler was not
* installed to begin with
*
* DESCRIPTION: Remove the SCI interrupt handler. No further SCIs will be
- * taken.
+ * taken. Remove all host-installed SCI handlers.
*
* Note: It doesn't seem important to disable all events or set the event
* enable registers to their original values. The OS should disable
@@ -262,13 +316,15 @@ AcpiEvInstallSciHandler (
******************************************************************************/
ACPI_STATUS
-AcpiEvRemoveSciHandler (
+AcpiEvRemoveAllSciHandlers (
void)
{
+ ACPI_SCI_HANDLER_INFO *SciHandler;
+ ACPI_CPU_FLAGS Flags;
ACPI_STATUS Status;
- ACPI_FUNCTION_TRACE (EvRemoveSciHandler);
+ ACPI_FUNCTION_TRACE (EvRemoveAllSciHandlers);
/* Just let the OS remove the handler and disable the level */
@@ -276,6 +332,23 @@ AcpiEvRemoveSciHandler (
Status = AcpiOsRemoveInterruptHandler ((UINT32) AcpiGbl_FADT.SciInterrupt,
AcpiEvSciXruptHandler);
+ if (!AcpiGbl_SciHandlerList)
+ {
+ return (Status);
+ }
+
+ Flags = AcpiOsAcquireLock (AcpiGbl_GpeLock);
+
+ /* Free all host-installed SCI handlers */
+
+ while (AcpiGbl_SciHandlerList)
+ {
+ SciHandler = AcpiGbl_SciHandlerList;
+ AcpiGbl_SciHandlerList = SciHandler->Next;
+ ACPI_FREE (SciHandler);
+ }
+
+ AcpiOsReleaseLock (AcpiGbl_GpeLock, Flags);
return_ACPI_STATUS (Status);
}
diff --git a/src/acpica/source/components/events/evxface.c b/src/acpica/source/components/events/evxface.c
index 79039ee..91bae82 100644
--- a/src/acpica/source/components/events/evxface.c
+++ b/src/acpica/source/components/events/evxface.c
@@ -115,6 +115,7 @@
#define __EVXFACE_C__
+#define EXPORT_ACPI_INTERFACES
#include "acpi.h"
#include "accommon.h"
@@ -507,6 +508,169 @@ ACPI_EXPORT_SYMBOL (AcpiInstallExceptionHandler)
#if (!ACPI_REDUCED_HARDWARE)
/*******************************************************************************
*
+ * FUNCTION: AcpiInstallSciHandler
+ *
+ * PARAMETERS: Address - Address of the handler
+ * Context - Value passed to the handler on each SCI
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Install a handler for a System Control Interrupt.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiInstallSciHandler (
+ ACPI_SCI_HANDLER Address,
+ void *Context)
+{
+ ACPI_SCI_HANDLER_INFO *NewSciHandler;
+ ACPI_SCI_HANDLER_INFO *SciHandler;
+ ACPI_CPU_FLAGS Flags;
+ ACPI_STATUS Status;
+
+
+ ACPI_FUNCTION_TRACE (AcpiInstallSciHandler);
+
+
+ if (!Address)
+ {
+ return_ACPI_STATUS (AE_BAD_PARAMETER);
+ }
+
+ /* Allocate and init a handler object */
+
+ NewSciHandler = ACPI_ALLOCATE (sizeof (ACPI_SCI_HANDLER_INFO));
+ if (!NewSciHandler)
+ {
+ return_ACPI_STATUS (AE_NO_MEMORY);
+ }
+
+ NewSciHandler->Address = Address;
+ NewSciHandler->Context = Context;
+
+ Status = AcpiUtAcquireMutex (ACPI_MTX_EVENTS);
+ if (ACPI_FAILURE (Status))
+ {
+ goto Exit;
+ }
+
+ /* Lock list during installation */
+
+ Flags = AcpiOsAcquireLock (AcpiGbl_GpeLock);
+ SciHandler = AcpiGbl_SciHandlerList;
+
+ /* Ensure handler does not already exist */
+
+ while (SciHandler)
+ {
+ if (Address == SciHandler->Address)
+ {
+ Status = AE_ALREADY_EXISTS;
+ goto UnlockAndExit;
+ }
+
+ SciHandler = SciHandler->Next;
+ }
+
+ /* Install the new handler into the global list (at head) */
+
+ NewSciHandler->Next = AcpiGbl_SciHandlerList;
+ AcpiGbl_SciHandlerList = NewSciHandler;
+
+
+UnlockAndExit:
+
+ AcpiOsReleaseLock (AcpiGbl_GpeLock, Flags);
+ (void) AcpiUtReleaseMutex (ACPI_MTX_EVENTS);
+
+Exit:
+ if (ACPI_FAILURE (Status))
+ {
+ ACPI_FREE (NewSciHandler);
+ }
+ return_ACPI_STATUS (Status);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiRemoveSciHandler
+ *
+ * PARAMETERS: Address - Address of the handler
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Remove a handler for a System Control Interrupt.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiRemoveSciHandler (
+ ACPI_SCI_HANDLER Address)
+{
+ ACPI_SCI_HANDLER_INFO *PrevSciHandler;
+ ACPI_SCI_HANDLER_INFO *NextSciHandler;
+ ACPI_CPU_FLAGS Flags;
+ ACPI_STATUS Status;
+
+
+ ACPI_FUNCTION_TRACE (AcpiRemoveSciHandler);
+
+
+ if (!Address)
+ {
+ return_ACPI_STATUS (AE_BAD_PARAMETER);
+ }
+
+ Status = AcpiUtAcquireMutex (ACPI_MTX_EVENTS);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+
+ /* Remove the SCI handler with lock */
+
+ Flags = AcpiOsAcquireLock (AcpiGbl_GpeLock);
+
+ PrevSciHandler = NULL;
+ NextSciHandler = AcpiGbl_SciHandlerList;
+ while (NextSciHandler)
+ {
+ if (NextSciHandler->Address == Address)
+ {
+ /* Unlink and free the SCI handler info block */
+
+ if (PrevSciHandler)
+ {
+ PrevSciHandler->Next = NextSciHandler->Next;
+ }
+ else
+ {
+ AcpiGbl_SciHandlerList = NextSciHandler->Next;
+ }
+
+ AcpiOsReleaseLock (AcpiGbl_GpeLock, Flags);
+ ACPI_FREE (NextSciHandler);
+ goto UnlockAndExit;
+ }
+
+ PrevSciHandler = NextSciHandler;
+ NextSciHandler = NextSciHandler->Next;
+ }
+
+ AcpiOsReleaseLock (AcpiGbl_GpeLock, Flags);
+ Status = AE_NOT_EXIST;
+
+
+UnlockAndExit:
+ (void) AcpiUtReleaseMutex (ACPI_MTX_EVENTS);
+ return_ACPI_STATUS (Status);
+}
+
+
+/*******************************************************************************
+ *
* FUNCTION: AcpiInstallGlobalEventHandler
*
* PARAMETERS: Handler - Pointer to the global event handler function
diff --git a/src/acpica/source/components/events/evxfevnt.c b/src/acpica/source/components/events/evxfevnt.c
index 47273ce..10780f3 100644
--- a/src/acpica/source/components/events/evxfevnt.c
+++ b/src/acpica/source/components/events/evxfevnt.c
@@ -115,6 +115,7 @@
#define __EVXFEVNT_C__
+#define EXPORT_ACPI_INTERFACES
#include "acpi.h"
#include "accommon.h"
diff --git a/src/acpica/source/components/events/evxfgpe.c b/src/acpica/source/components/events/evxfgpe.c
index 4a756c9..9b4ce30 100644
--- a/src/acpica/source/components/events/evxfgpe.c
+++ b/src/acpica/source/components/events/evxfgpe.c
@@ -115,6 +115,7 @@
#define __EVXFGPE_C__
+#define EXPORT_ACPI_INTERFACES
#include "acpi.h"
#include "accommon.h"
diff --git a/src/acpica/source/components/events/evxfregn.c b/src/acpica/source/components/events/evxfregn.c
index 12ec482..eefb119 100644
--- a/src/acpica/source/components/events/evxfregn.c
+++ b/src/acpica/source/components/events/evxfregn.c
@@ -115,6 +115,7 @@
*****************************************************************************/
#define __EVXFREGN_C__
+#define EXPORT_ACPI_INTERFACES
#include "acpi.h"
#include "accommon.h"
diff --git a/src/acpica/source/components/executer/exstore.c b/src/acpica/source/components/executer/exstore.c
index 4f50aa3..3524c5a 100644
--- a/src/acpica/source/components/executer/exstore.c
+++ b/src/acpica/source/components/executer/exstore.c
@@ -134,6 +134,12 @@ AcpiExStoreObjectToIndex (
ACPI_OPERAND_OBJECT *DestDesc,
ACPI_WALK_STATE *WalkState);
+static ACPI_STATUS
+AcpiExStoreDirectToNode (
+ ACPI_OPERAND_OBJECT *SourceDesc,
+ ACPI_NAMESPACE_NODE *Node,
+ ACPI_WALK_STATE *WalkState);
+
/*******************************************************************************
*
@@ -465,7 +471,11 @@ AcpiExStoreObjectToIndex (
* When storing into an object the data is converted to the
* target object type then stored in the object. This means
* that the target object type (for an initialized target) will
- * not be changed by a store operation.
+ * not be changed by a store operation. A CopyObject can change
+ * the target type, however.
+ *
+ * The ImplicitConversion flag is set to NO/FALSE only when
+ * storing to an ArgX -- as per the rules of the ACPI spec.
*
* Assumes parameters are already validated.
*
@@ -492,7 +502,7 @@ AcpiExStoreObjectToNode (
TargetType = AcpiNsGetType (Node);
TargetDesc = AcpiNsGetAttachedObject (Node);
- ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Storing %p(%s) into node %p(%s)\n",
+ ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Storing %p (%s) to node %p (%s)\n",
SourceDesc, AcpiUtGetObjectTypeName (SourceDesc),
Node, AcpiUtGetTypeName (TargetType)));
@@ -506,49 +516,35 @@ AcpiExStoreObjectToNode (
return_ACPI_STATUS (Status);
}
- /* If no implicit conversion, drop into the default case below */
-
- if ((!ImplicitConversion) ||
- ((WalkState->Opcode == AML_COPY_OP) &&
- (TargetType != ACPI_TYPE_LOCAL_REGION_FIELD) &&
- (TargetType != ACPI_TYPE_LOCAL_BANK_FIELD) &&
- (TargetType != ACPI_TYPE_LOCAL_INDEX_FIELD)))
- {
- /*
- * Force execution of default (no implicit conversion). Note:
- * CopyObject does not perform an implicit conversion, as per the ACPI
- * spec -- except in case of region/bank/index fields -- because these
- * objects must retain their original type permanently.
- */
- TargetType = ACPI_TYPE_ANY;
- }
-
/* Do the actual store operation */
switch (TargetType)
{
- case ACPI_TYPE_BUFFER_FIELD:
- case ACPI_TYPE_LOCAL_REGION_FIELD:
- case ACPI_TYPE_LOCAL_BANK_FIELD:
- case ACPI_TYPE_LOCAL_INDEX_FIELD:
-
- /* For fields, copy the source data to the target field. */
-
- Status = AcpiExWriteDataToField (SourceDesc, TargetDesc,
- &WalkState->ResultObj);
- break;
-
case ACPI_TYPE_INTEGER:
case ACPI_TYPE_STRING:
case ACPI_TYPE_BUFFER:
/*
- * These target types are all of type Integer/String/Buffer, and
- * therefore support implicit conversion before the store.
- *
- * Copy and/or convert the source object to a new target object
+ * The simple data types all support implicit source operand
+ * conversion before the store.
*/
+
+ if ((WalkState->Opcode == AML_COPY_OP) ||
+ !ImplicitConversion)
+ {
+ /*
+ * However, CopyObject and Stores to ArgX do not perform
+ * an implicit conversion, as per the ACPI specification.
+ * A direct store is performed instead.
+ */
+ Status = AcpiExStoreDirectToNode (SourceDesc, Node,
+ WalkState);
+ break;
+ }
+
+ /* Store with implicit source operand conversion support */
+
Status = AcpiExStoreObjectToObject (SourceDesc, TargetDesc,
- &NewDesc, WalkState);
+ &NewDesc, WalkState);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
@@ -561,11 +557,12 @@ AcpiExStoreObjectToNode (
* the Name's type to that of the value being stored in it.
* SourceDesc reference count is incremented by AttachObject.
*
- * Note: This may change the type of the node if an explicit store
- * has been performed such that the node/object type has been
- * changed.
+ * Note: This may change the type of the node if an explicit
+ * store has been performed such that the node/object type
+ * has been changed.
*/
- Status = AcpiNsAttachObject (Node, NewDesc, NewDesc->Common.Type);
+ Status = AcpiNsAttachObject (Node, NewDesc,
+ NewDesc->Common.Type);
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
"Store %s into %s via Convert/Attach\n",
@@ -574,33 +571,86 @@ AcpiExStoreObjectToNode (
}
break;
- default:
-
- ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
- "Storing [%s] (%p) directly into node [%s] (%p)"
- " with no implicit conversion\n",
- AcpiUtGetObjectTypeName (SourceDesc), SourceDesc,
- AcpiUtGetObjectTypeName (TargetDesc), Node));
+ case ACPI_TYPE_BUFFER_FIELD:
+ case ACPI_TYPE_LOCAL_REGION_FIELD:
+ case ACPI_TYPE_LOCAL_BANK_FIELD:
+ case ACPI_TYPE_LOCAL_INDEX_FIELD:
+ /*
+ * For all fields, always write the source data to the target
+ * field. Any required implicit source operand conversion is
+ * performed in the function below as necessary. Note, field
+ * objects must retain their original type permanently.
+ */
+ Status = AcpiExWriteDataToField (SourceDesc, TargetDesc,
+ &WalkState->ResultObj);
+ break;
+ default:
/*
* No conversions for all other types. Directly store a copy of
- * the source object. NOTE: This is a departure from the ACPI
- * spec, which states "If conversion is impossible, abort the
- * running control method".
+ * the source object. This is the ACPI spec-defined behavior for
+ * the CopyObject operator.
*
- * This code implements "If conversion is impossible, treat the
- * Store operation as a CopyObject".
+ * NOTE: For the Store operator, this is a departure from the
+ * ACPI spec, which states "If conversion is impossible, abort
+ * the running control method". Instead, this code implements
+ * "If conversion is impossible, treat the Store operation as
+ * a CopyObject".
*/
- Status = AcpiUtCopyIobjectToIobject (SourceDesc, &NewDesc, WalkState);
- if (ACPI_FAILURE (Status))
- {
- return_ACPI_STATUS (Status);
- }
-
- Status = AcpiNsAttachObject (Node, NewDesc, NewDesc->Common.Type);
- AcpiUtRemoveReference (NewDesc);
+ Status = AcpiExStoreDirectToNode (SourceDesc, Node,
+ WalkState);
break;
}
return_ACPI_STATUS (Status);
}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiExStoreDirectToNode
+ *
+ * PARAMETERS: SourceDesc - Value to be stored
+ * Node - Named object to receive the value
+ * WalkState - Current walk state
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: "Store" an object directly to a node. This involves a copy
+ * and an attach.
+ *
+ ******************************************************************************/
+
+static ACPI_STATUS
+AcpiExStoreDirectToNode (
+ ACPI_OPERAND_OBJECT *SourceDesc,
+ ACPI_NAMESPACE_NODE *Node,
+ ACPI_WALK_STATE *WalkState)
+{
+ ACPI_STATUS Status;
+ ACPI_OPERAND_OBJECT *NewDesc;
+
+
+ ACPI_FUNCTION_TRACE (ExStoreDirectToNode);
+
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
+ "Storing [%s] (%p) directly into node [%s] (%p)"
+ " with no implicit conversion\n",
+ AcpiUtGetObjectTypeName (SourceDesc), SourceDesc,
+ AcpiUtGetTypeName (Node->Type), Node));
+
+ /* Copy the source object to a new object */
+
+ Status = AcpiUtCopyIobjectToIobject (SourceDesc, &NewDesc, WalkState);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+
+ /* Attach the new object to the node */
+
+ Status = AcpiNsAttachObject (Node, NewDesc, NewDesc->Common.Type);
+ AcpiUtRemoveReference (NewDesc);
+ return_ACPI_STATUS (Status);
+}
diff --git a/src/acpica/source/components/hardware/hwxface.c b/src/acpica/source/components/hardware/hwxface.c
index 61a96de..36f4e5c 100644
--- a/src/acpica/source/components/hardware/hwxface.c
+++ b/src/acpica/source/components/hardware/hwxface.c
@@ -113,6 +113,8 @@
*
*****************************************************************************/
+#define EXPORT_ACPI_INTERFACES
+
#include "acpi.h"
#include "accommon.h"
#include "acnamesp.h"
@@ -162,9 +164,15 @@ AcpiReset (
* For I/O space, write directly to the OSL. This bypasses the port
* validation mechanism, which may block a valid write to the reset
* register.
+ *
+ * NOTE:
+ * The ACPI spec requires the reset register width to be 8, so we
+ * hardcode it here and ignore the FADT value. This maintains
+ * compatibility with other ACPI implementations that have allowed
+ * BIOS code with bad register width values to go unnoticed.
*/
Status = AcpiOsWritePort ((ACPI_IO_ADDRESS) ResetReg->Address,
- AcpiGbl_FADT.ResetValue, ResetReg->BitWidth);
+ AcpiGbl_FADT.ResetValue, ACPI_RESET_REGISTER_WIDTH);
}
else
{
@@ -203,7 +211,8 @@ AcpiRead (
UINT64 *ReturnValue,
ACPI_GENERIC_ADDRESS *Reg)
{
- UINT32 Value;
+ UINT32 ValueLo;
+ UINT32 ValueHi;
UINT32 Width;
UINT64 Address;
ACPI_STATUS Status;
@@ -225,13 +234,8 @@ AcpiRead (
return (Status);
}
- /* Initialize entire 64-bit return value to zero */
-
- *ReturnValue = 0;
- Value = 0;
-
/*
- * Two address spaces supported: Memory or IO. PCI_Config is
+ * Two address spaces supported: Memory or I/O. PCI_Config is
* not supported here because the GAS structure is insufficient
*/
if (Reg->SpaceId == ACPI_ADR_SPACE_SYSTEM_MEMORY)
@@ -245,6 +249,9 @@ AcpiRead (
}
else /* ACPI_ADR_SPACE_SYSTEM_IO, validated earlier */
{
+ ValueLo = 0;
+ ValueHi = 0;
+
Width = Reg->BitWidth;
if (Width == 64)
{
@@ -252,25 +259,27 @@ AcpiRead (
}
Status = AcpiHwReadPort ((ACPI_IO_ADDRESS)
- Address, &Value, Width);
+ Address, &ValueLo, Width);
if (ACPI_FAILURE (Status))
{
return (Status);
}
- *ReturnValue = Value;
if (Reg->BitWidth == 64)
{
/* Read the top 32 bits */
Status = AcpiHwReadPort ((ACPI_IO_ADDRESS)
- (Address + 4), &Value, 32);
+ (Address + 4), &ValueHi, 32);
if (ACPI_FAILURE (Status))
{
return (Status);
}
- *ReturnValue |= ((UINT64) Value << 32);
}
+
+ /* Set the return value only if status is AE_OK */
+
+ *ReturnValue = (ValueLo | ((UINT64) ValueHi << 32));
}
ACPI_DEBUG_PRINT ((ACPI_DB_IO,
@@ -279,7 +288,7 @@ AcpiRead (
ACPI_FORMAT_UINT64 (Address),
AcpiUtGetRegionName (Reg->SpaceId)));
- return (Status);
+ return (AE_OK);
}
ACPI_EXPORT_SYMBOL (AcpiRead)
diff --git a/src/acpica/source/components/hardware/hwxfsleep.c b/src/acpica/source/components/hardware/hwxfsleep.c
index b5ae313..8369600 100644
--- a/src/acpica/source/components/hardware/hwxfsleep.c
+++ b/src/acpica/source/components/hardware/hwxfsleep.c
@@ -113,6 +113,8 @@
*
*****************************************************************************/
+#define EXPORT_ACPI_INTERFACES
+
#include "acpi.h"
#include "accommon.h"
diff --git a/src/acpica/source/components/namespace/nsdump.c b/src/acpica/source/components/namespace/nsdump.c
index 233ded6..d62ca29 100644
--- a/src/acpica/source/components/namespace/nsdump.c
+++ b/src/acpica/source/components/namespace/nsdump.c
@@ -142,6 +142,22 @@ AcpiNsDumpOneDevice (
#if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER)
+
+static ACPI_STATUS
+AcpiNsDumpOneObjectPath (
+ ACPI_HANDLE ObjHandle,
+ UINT32 Level,
+ void *Context,
+ void **ReturnValue);
+
+static ACPI_STATUS
+AcpiNsGetMaxDepth (
+ ACPI_HANDLE ObjHandle,
+ UINT32 Level,
+ void *Context,
+ void **ReturnValue);
+
+
/*******************************************************************************
*
* FUNCTION: AcpiNsPrintPathname
@@ -770,6 +786,149 @@ AcpiNsDumpObjects (
/*******************************************************************************
*
+ * FUNCTION: AcpiNsDumpOneObjectPath, AcpiNsGetMaxDepth
+ *
+ * PARAMETERS: ObjHandle - Node to be dumped
+ * Level - Nesting level of the handle
+ * Context - Passed into WalkNamespace
+ * ReturnValue - Not used
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Dump the full pathname to a namespace object. AcpNsGetMaxDepth
+ * computes the maximum nesting depth in the namespace tree, in
+ * order to simplify formatting in AcpiNsDumpOneObjectPath.
+ * These procedures are UserFunctions called by AcpiNsWalkNamespace.
+ *
+ ******************************************************************************/
+
+static ACPI_STATUS
+AcpiNsDumpOneObjectPath (
+ ACPI_HANDLE ObjHandle,
+ UINT32 Level,
+ void *Context,
+ void **ReturnValue)
+{
+ UINT32 MaxLevel = *((UINT32 *) Context);
+ char *Pathname;
+ ACPI_NAMESPACE_NODE *Node;
+ int PathIndent;
+
+
+ if (!ObjHandle)
+ {
+ return (AE_OK);
+ }
+
+ Node = AcpiNsValidateHandle (ObjHandle);
+ if (!Node)
+ {
+ /* Ignore bad node during namespace walk */
+
+ return (AE_OK);
+ }
+
+ Pathname = AcpiNsGetExternalPathname (Node);
+
+ PathIndent = 1;
+ if (Level <= MaxLevel)
+ {
+ PathIndent = MaxLevel - Level + 1;
+ }
+
+ AcpiOsPrintf ("%2d%*s%-12s%*s",
+ Level, Level, " ", AcpiUtGetTypeName (Node->Type),
+ PathIndent, " ");
+
+ AcpiOsPrintf ("%s\n", &Pathname[1]);
+ ACPI_FREE (Pathname);
+ return (AE_OK);
+}
+
+
+static ACPI_STATUS
+AcpiNsGetMaxDepth (
+ ACPI_HANDLE ObjHandle,
+ UINT32 Level,
+ void *Context,
+ void **ReturnValue)
+{
+ UINT32 *MaxLevel = (UINT32 *) Context;
+
+
+ if (Level > *MaxLevel)
+ {
+ *MaxLevel = Level;
+ }
+ return (AE_OK);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiNsDumpObjectPaths
+ *
+ * PARAMETERS: Type - Object type to be dumped
+ * DisplayType - 0 or ACPI_DISPLAY_SUMMARY
+ * MaxDepth - Maximum depth of dump. Use ACPI_UINT32_MAX
+ * for an effectively unlimited depth.
+ * OwnerId - Dump only objects owned by this ID. Use
+ * ACPI_UINT32_MAX to match all owners.
+ * StartHandle - Where in namespace to start/end search
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Dump full object pathnames within the loaded namespace. Uses
+ * AcpiNsWalkNamespace in conjunction with AcpiNsDumpOneObjectPath.
+ *
+ ******************************************************************************/
+
+void
+AcpiNsDumpObjectPaths (
+ ACPI_OBJECT_TYPE Type,
+ UINT8 DisplayType,
+ UINT32 MaxDepth,
+ ACPI_OWNER_ID OwnerId,
+ ACPI_HANDLE StartHandle)
+{
+ ACPI_STATUS Status;
+ UINT32 MaxLevel = 0;
+
+
+ ACPI_FUNCTION_ENTRY ();
+
+
+ /*
+ * Just lock the entire namespace for the duration of the dump.
+ * We don't want any changes to the namespace during this time,
+ * especially the temporary nodes since we are going to display
+ * them also.
+ */
+ Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE);
+ if (ACPI_FAILURE (Status))
+ {
+ AcpiOsPrintf ("Could not acquire namespace mutex\n");
+ return;
+ }
+
+ /* Get the max depth of the namespace tree, for formatting later */
+
+ (void) AcpiNsWalkNamespace (Type, StartHandle, MaxDepth,
+ ACPI_NS_WALK_NO_UNLOCK | ACPI_NS_WALK_TEMP_NODES,
+ AcpiNsGetMaxDepth, NULL, (void *) &MaxLevel, NULL);
+
+ /* Now dump the entire namespace */
+
+ (void) AcpiNsWalkNamespace (Type, StartHandle, MaxDepth,
+ ACPI_NS_WALK_NO_UNLOCK | ACPI_NS_WALK_TEMP_NODES,
+ AcpiNsDumpOneObjectPath, NULL, (void *) &MaxLevel, NULL);
+
+ (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
+}
+
+
+/*******************************************************************************
+ *
* FUNCTION: AcpiNsDumpEntry
*
* PARAMETERS: Handle - Node to be dumped
diff --git a/src/acpica/source/components/namespace/nsxfeval.c b/src/acpica/source/components/namespace/nsxfeval.c
index 650b774..d8b3480 100644
--- a/src/acpica/source/components/namespace/nsxfeval.c
+++ b/src/acpica/source/components/namespace/nsxfeval.c
@@ -116,6 +116,7 @@
#define __NSXFEVAL_C__
+#define EXPORT_ACPI_INTERFACES
#include "acpi.h"
#include "accommon.h"
@@ -220,8 +221,12 @@ AcpiEvaluateObjectTyped (
if (MustFree)
{
- /* Caller used ACPI_ALLOCATE_BUFFER, free the return buffer */
-
+ /*
+ * Caller used ACPI_ALLOCATE_BUFFER, free the return buffer.
+ * Note: We use AcpiOsFree here because AcpiOsAllocate was used
+ * to allocate the buffer. This purposefully bypasses the internal
+ * allocation tracking mechanism (if it is enabled).
+ */
AcpiOsFree (ReturnBuffer->Pointer);
ReturnBuffer->Pointer = NULL;
}
@@ -726,10 +731,19 @@ AcpiWalkNamespace (
goto UnlockAndExit;
}
+ /* Now we can validate the starting node */
+
+ if (!AcpiNsValidateHandle (StartObject))
+ {
+ Status = AE_BAD_PARAMETER;
+ goto UnlockAndExit2;
+ }
+
Status = AcpiNsWalkNamespace (Type, StartObject, MaxDepth,
ACPI_NS_WALK_UNLOCK, DescendingCallback,
AscendingCallback, Context, ReturnValue);
+UnlockAndExit2:
(void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
UnlockAndExit:
diff --git a/src/acpica/source/components/namespace/nsxfname.c b/src/acpica/source/components/namespace/nsxfname.c
index 530d94a..a4bca31 100644
--- a/src/acpica/source/components/namespace/nsxfname.c
+++ b/src/acpica/source/components/namespace/nsxfname.c
@@ -115,6 +115,7 @@
*****************************************************************************/
#define __NSXFNAME_C__
+#define EXPORT_ACPI_INTERFACES
#include "acpi.h"
#include "accommon.h"
diff --git a/src/acpica/source/components/namespace/nsxfobj.c b/src/acpica/source/components/namespace/nsxfobj.c
index 147d025..233ce26 100644
--- a/src/acpica/source/components/namespace/nsxfobj.c
+++ b/src/acpica/source/components/namespace/nsxfobj.c
@@ -116,6 +116,7 @@
#define __NSXFOBJ_C__
+#define EXPORT_ACPI_INTERFACES
#include "acpi.h"
#include "accommon.h"
diff --git a/src/acpica/source/components/resources/rsxface.c b/src/acpica/source/components/resources/rsxface.c
index 0401b0d..1ae45b0 100644
--- a/src/acpica/source/components/resources/rsxface.c
+++ b/src/acpica/source/components/resources/rsxface.c
@@ -115,6 +115,7 @@
#define __RSXFACE_C__
+#define EXPORT_ACPI_INTERFACES
#include "acpi.h"
#include "accommon.h"
diff --git a/src/acpica/source/components/tables/tbinstal.c b/src/acpica/source/components/tables/tbinstal.c
index a67e26d..429abbc 100644
--- a/src/acpica/source/components/tables/tbinstal.c
+++ b/src/acpica/source/components/tables/tbinstal.c
@@ -165,14 +165,9 @@ AcpiTbVerifyTable (
}
}
- /* FACS is the odd table, has no standard ACPI header and no checksum */
+ /* Always calculate checksum, ignore bad checksum if requested */
- if (!ACPI_COMPARE_NAME (&TableDesc->Signature, ACPI_SIG_FACS))
- {
- /* Always calculate checksum, ignore bad checksum if requested */
-
- Status = AcpiTbVerifyChecksum (TableDesc->Pointer, TableDesc->Length);
- }
+ Status = AcpiTbVerifyChecksum (TableDesc->Pointer, TableDesc->Length);
return_ACPI_STATUS (Status);
}
diff --git a/src/acpica/source/components/tables/tbprint.c b/src/acpica/source/components/tables/tbprint.c
index d1d4bc9..d04f161 100644
--- a/src/acpica/source/components/tables/tbprint.c
+++ b/src/acpica/source/components/tables/tbprint.c
@@ -226,11 +226,11 @@ AcpiTbPrintTableHeader (
{
/* FACS only has signature and length fields */
- ACPI_INFO ((AE_INFO, "%4.4s %p %05X",
+ ACPI_INFO ((AE_INFO, "%4.4s %p %06X",
Header->Signature, ACPI_CAST_PTR (void, Address),
Header->Length));
}
- else if (ACPI_COMPARE_NAME (Header->Signature, ACPI_SIG_RSDP))
+ else if (ACPI_VALIDATE_RSDP_SIG (Header->Signature))
{
/* RSDP has no common fields */
@@ -238,7 +238,7 @@ AcpiTbPrintTableHeader (
ACPI_CAST_PTR (ACPI_TABLE_RSDP, Header)->OemId, ACPI_OEM_ID_SIZE);
AcpiTbFixString (LocalHeader.OemId, ACPI_OEM_ID_SIZE);
- ACPI_INFO ((AE_INFO, "RSDP %p %05X (v%.2d %6.6s)",
+ ACPI_INFO ((AE_INFO, "RSDP %p %06X (v%.2d %6.6s)",
ACPI_CAST_PTR (void, Address),
(ACPI_CAST_PTR (ACPI_TABLE_RSDP, Header)->Revision > 0) ?
ACPI_CAST_PTR (ACPI_TABLE_RSDP, Header)->Length : 20,
@@ -252,7 +252,7 @@ AcpiTbPrintTableHeader (
AcpiTbCleanupTableHeader (&LocalHeader, Header);
ACPI_INFO ((AE_INFO,
- "%4.4s %p %05X (v%.2d %6.6s %8.8s %08X %4.4s %08X)",
+ "%4.4s %p %06X (v%.2d %6.6s %8.8s %08X %4.4s %08X)",
LocalHeader.Signature, ACPI_CAST_PTR (void, Address),
LocalHeader.Length, LocalHeader.Revision, LocalHeader.OemId,
LocalHeader.OemTableId, LocalHeader.OemRevision,
@@ -283,6 +283,17 @@ AcpiTbVerifyChecksum (
UINT8 Checksum;
+ /*
+ * FACS/S3PT:
+ * They are the odd tables, have no standard ACPI header and no checksum
+ */
+
+ if (ACPI_COMPARE_NAME (Table->Signature, ACPI_SIG_S3PT) ||
+ ACPI_COMPARE_NAME (Table->Signature, ACPI_SIG_FACS))
+ {
+ return (AE_OK);
+ }
+
/* Compute the checksum on the table */
Checksum = AcpiTbChecksum (ACPI_CAST_PTR (UINT8, Table), Length);
diff --git a/src/acpica/source/components/tables/tbxface.c b/src/acpica/source/components/tables/tbxface.c
index cbaad11..7076e4a 100644
--- a/src/acpica/source/components/tables/tbxface.c
+++ b/src/acpica/source/components/tables/tbxface.c
@@ -114,6 +114,7 @@
*****************************************************************************/
#define __TBXFACE_C__
+#define EXPORT_ACPI_INTERFACES
#include "acpi.h"
#include "accommon.h"
@@ -233,7 +234,7 @@ AcpiInitializeTables (
return_ACPI_STATUS (Status);
}
-ACPI_EXPORT_SYMBOL (AcpiInitializeTables)
+ACPI_EXPORT_SYMBOL_INIT (AcpiInitializeTables)
/*******************************************************************************
@@ -276,7 +277,7 @@ AcpiReallocateRootTable (
return_ACPI_STATUS (Status);
}
-ACPI_EXPORT_SYMBOL (AcpiReallocateRootTable)
+ACPI_EXPORT_SYMBOL_INIT (AcpiReallocateRootTable)
/*******************************************************************************
diff --git a/src/acpica/source/components/tables/tbxfload.c b/src/acpica/source/components/tables/tbxfload.c
index 734d9a6..b7a8b24 100644
--- a/src/acpica/source/components/tables/tbxfload.c
+++ b/src/acpica/source/components/tables/tbxfload.c
@@ -114,6 +114,7 @@
*****************************************************************************/
#define __TBXFLOAD_C__
+#define EXPORT_ACPI_INTERFACES
#include "acpi.h"
#include "accommon.h"
@@ -164,7 +165,7 @@ AcpiLoadTables (
return_ACPI_STATUS (Status);
}
-ACPI_EXPORT_SYMBOL (AcpiLoadTables)
+ACPI_EXPORT_SYMBOL_INIT (AcpiLoadTables)
/*******************************************************************************
diff --git a/src/acpica/source/components/tables/tbxfroot.c b/src/acpica/source/components/tables/tbxfroot.c
index b9db205..6ad19a5 100644
--- a/src/acpica/source/components/tables/tbxfroot.c
+++ b/src/acpica/source/components/tables/tbxfroot.c
@@ -147,8 +147,7 @@ AcpiTbValidateRsdp (
* Note: Sometimes there exists more than one RSDP in memory; the valid
* RSDP has a valid checksum, all others have an invalid checksum.
*/
- if (ACPI_STRNCMP ((char *) Rsdp->Signature, ACPI_SIG_RSDP,
- sizeof (ACPI_SIG_RSDP)-1) != 0)
+ if (!ACPI_VALIDATE_RSDP_SIG (Rsdp->Signature))
{
/* Nope, BAD Signature */
diff --git a/src/acpica/source/components/utilities/utalloc.c b/src/acpica/source/components/utilities/utalloc.c
index 38feda1..5c672fd 100644
--- a/src/acpica/source/components/utilities/utalloc.c
+++ b/src/acpica/source/components/utilities/utalloc.c
@@ -123,6 +123,45 @@
ACPI_MODULE_NAME ("utalloc")
+#if !defined (USE_NATIVE_ALLOCATE_ZEROED)
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiOsAllocateZeroed
+ *
+ * PARAMETERS: Size - Size of the allocation
+ *
+ * RETURN: Address of the allocated memory on success, NULL on failure.
+ *
+ * DESCRIPTION: Subsystem equivalent of calloc. Allocate and zero memory.
+ * This is the default implementation. Can be overridden via the
+ * USE_NATIVE_ALLOCATE_ZEROED flag.
+ *
+ ******************************************************************************/
+
+void *
+AcpiOsAllocateZeroed (
+ ACPI_SIZE Size)
+{
+ void *Allocation;
+
+
+ ACPI_FUNCTION_ENTRY ();
+
+
+ Allocation = AcpiOsAllocate (Size);
+ if (Allocation)
+ {
+ /* Clear the memory block */
+
+ ACPI_MEMSET (Allocation, 0, Size);
+ }
+
+ return (Allocation);
+}
+
+#endif /* !USE_NATIVE_ALLOCATE_ZEROED */
+
+
/*******************************************************************************
*
* FUNCTION: AcpiUtCreateCaches
@@ -393,95 +432,3 @@ AcpiUtInitializeBuffer (
ACPI_MEMSET (Buffer->Pointer, 0, RequiredLength);
return (AE_OK);
}
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiUtAllocate
- *
- * PARAMETERS: Size - Size of the allocation
- * Component - Component type of caller
- * Module - Source file name of caller
- * Line - Line number of caller
- *
- * RETURN: Address of the allocated memory on success, NULL on failure.
- *
- * DESCRIPTION: Subsystem equivalent of malloc.
- *
- ******************************************************************************/
-
-void *
-AcpiUtAllocate (
- ACPI_SIZE Size,
- UINT32 Component,
- const char *Module,
- UINT32 Line)
-{
- void *Allocation;
-
-
- ACPI_FUNCTION_TRACE_U32 (UtAllocate, Size);
-
-
- /* Check for an inadvertent size of zero bytes */
-
- if (!Size)
- {
- ACPI_WARNING ((Module, Line,
- "Attempt to allocate zero bytes, allocating 1 byte"));
- Size = 1;
- }
-
- Allocation = AcpiOsAllocate (Size);
- if (!Allocation)
- {
- /* Report allocation error */
-
- ACPI_WARNING ((Module, Line,
- "Could not allocate size %u", (UINT32) Size));
-
- return_PTR (NULL);
- }
-
- return_PTR (Allocation);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiUtAllocateZeroed
- *
- * PARAMETERS: Size - Size of the allocation
- * Component - Component type of caller
- * Module - Source file name of caller
- * Line - Line number of caller
- *
- * RETURN: Address of the allocated memory on success, NULL on failure.
- *
- * DESCRIPTION: Subsystem equivalent of calloc. Allocate and zero memory.
- *
- ******************************************************************************/
-
-void *
-AcpiUtAllocateZeroed (
- ACPI_SIZE Size,
- UINT32 Component,
- const char *Module,
- UINT32 Line)
-{
- void *Allocation;
-
-
- ACPI_FUNCTION_ENTRY ();
-
-
- Allocation = AcpiUtAllocate (Size, Component, Module, Line);
- if (Allocation)
- {
- /* Clear the memory block */
-
- ACPI_MEMSET (Allocation, 0, Size);
- }
-
- return (Allocation);
-}
diff --git a/src/acpica/source/components/utilities/utdebug.c b/src/acpica/source/components/utilities/utdebug.c
index 88fa4d6..af904ac 100644
--- a/src/acpica/source/components/utilities/utdebug.c
+++ b/src/acpica/source/components/utilities/utdebug.c
@@ -114,6 +114,7 @@
*****************************************************************************/
#define __UTDEBUG_C__
+#define EXPORT_ACPI_INTERFACES
#include "acpi.h"
#include "accommon.h"
@@ -288,7 +289,7 @@ AcpiDebugPrint (
* Display the module name, current line number, thread ID (if requested),
* current procedure nesting level, and the current procedure name
*/
- AcpiOsPrintf ("%8s-%04ld ", ModuleName, LineNumber);
+ AcpiOsPrintf ("%9s-%04ld ", ModuleName, LineNumber);
if (ACPI_LV_THREADS & AcpiDbgLevel)
{
diff --git a/src/acpica/source/components/utilities/utexcep.c b/src/acpica/source/components/utilities/utexcep.c
index 2d7c4e0..28ae7ac 100644
--- a/src/acpica/source/components/utilities/utexcep.c
+++ b/src/acpica/source/components/utilities/utexcep.c
@@ -115,6 +115,7 @@
#define __UTEXCEP_C__
+#define EXPORT_ACPI_INTERFACES
#define ACPI_DEFINE_EXCEPTION_TABLE
#include "acpi.h"
diff --git a/src/acpica/source/components/utilities/utglobal.c b/src/acpica/source/components/utilities/utglobal.c
index 1ce7610..8c5c593 100644
--- a/src/acpica/source/components/utilities/utglobal.c
+++ b/src/acpica/source/components/utilities/utglobal.c
@@ -114,6 +114,7 @@
*****************************************************************************/
#define __UTGLOBAL_C__
+#define EXPORT_ACPI_INTERFACES
#define DEFINE_ACPI_GLOBALS
#include "acpi.h"
@@ -346,7 +347,7 @@ AcpiUtInitGlobals (
#if (!ACPI_REDUCED_HARDWARE)
- /* GPE support */
+ /* GPE/SCI support */
AcpiGbl_AllGpesInitialized = FALSE;
AcpiGbl_GpeXruptListHead = NULL;
@@ -355,6 +356,7 @@ AcpiUtInitGlobals (
AcpiCurrentGpeCount = 0;
AcpiGbl_GlobalEventHandler = NULL;
+ AcpiGbl_SciHandlerList = NULL;
#endif /* !ACPI_REDUCED_HARDWARE */
diff --git a/src/acpica/source/components/utilities/utstring.c b/src/acpica/source/components/utilities/utstring.c
index a8c928d..3a731d6 100644
--- a/src/acpica/source/components/utilities/utstring.c
+++ b/src/acpica/source/components/utilities/utstring.c
@@ -757,3 +757,78 @@ UtConvertBackslashes (
}
}
#endif
+
+#if defined (ACPI_DEBUGGER) || defined (ACPI_APPLICATION)
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiUtSafeStrcpy, AcpiUtSafeStrcat, AcpiUtSafeStrncat
+ *
+ * PARAMETERS: Adds a "DestSize" parameter to each of the standard string
+ * functions. This is the size of the Destination buffer.
+ *
+ * RETURN: TRUE if the operation would overflow the destination buffer.
+ *
+ * DESCRIPTION: Safe versions of standard Clib string functions. Ensure that
+ * the result of the operation will not overflow the output string
+ * buffer.
+ *
+ * NOTE: These functions are typically only helpful for processing
+ * user input and command lines. For most ACPICA code, the
+ * required buffer length is precisely calculated before buffer
+ * allocation, so the use of these functions is unnecessary.
+ *
+ ******************************************************************************/
+
+BOOLEAN
+AcpiUtSafeStrcpy (
+ char *Dest,
+ ACPI_SIZE DestSize,
+ char *Source)
+{
+
+ if (ACPI_STRLEN (Source) >= DestSize)
+ {
+ return (TRUE);
+ }
+
+ ACPI_STRCPY (Dest, Source);
+ return (FALSE);
+}
+
+BOOLEAN
+AcpiUtSafeStrcat (
+ char *Dest,
+ ACPI_SIZE DestSize,
+ char *Source)
+{
+
+ if ((ACPI_STRLEN (Dest) + ACPI_STRLEN (Source)) >= DestSize)
+ {
+ return (TRUE);
+ }
+
+ ACPI_STRCAT (Dest, Source);
+ return (FALSE);
+}
+
+BOOLEAN
+AcpiUtSafeStrncat (
+ char *Dest,
+ ACPI_SIZE DestSize,
+ char *Source,
+ ACPI_SIZE MaxTransferLength)
+{
+ ACPI_SIZE ActualTransferLength;
+
+
+ ActualTransferLength = ACPI_MIN (MaxTransferLength, ACPI_STRLEN (Source));
+
+ if ((ACPI_STRLEN (Dest) + ActualTransferLength) >= DestSize)
+ {
+ return (TRUE);
+ }
+
+ ACPI_STRNCAT (Dest, Source, MaxTransferLength);
+ return (FALSE);
+}
+#endif
diff --git a/src/acpica/source/components/utilities/uttrack.c b/src/acpica/source/components/utilities/uttrack.c
index 26a514b..8cf189c 100644
--- a/src/acpica/source/components/utilities/uttrack.c
+++ b/src/acpica/source/components/utilities/uttrack.c
@@ -223,10 +223,23 @@ AcpiUtAllocateAndTrack (
ACPI_STATUS Status;
- Allocation = AcpiUtAllocate (Size + sizeof (ACPI_DEBUG_MEM_HEADER),
- Component, Module, Line);
+ /* Check for an inadvertent size of zero bytes */
+
+ if (!Size)
+ {
+ ACPI_WARNING ((Module, Line,
+ "Attempt to allocate zero bytes, allocating 1 byte"));
+ Size = 1;
+ }
+
+ Allocation = AcpiOsAllocate (Size + sizeof (ACPI_DEBUG_MEM_HEADER));
if (!Allocation)
{
+ /* Report allocation error */
+
+ ACPI_WARNING ((Module, Line,
+ "Could not allocate size %u", (UINT32) Size));
+
return (NULL);
}
@@ -276,8 +289,16 @@ AcpiUtAllocateZeroedAndTrack (
ACPI_STATUS Status;
- Allocation = AcpiUtAllocateZeroed (Size + sizeof (ACPI_DEBUG_MEM_HEADER),
- Component, Module, Line);
+ /* Check for an inadvertent size of zero bytes */
+
+ if (!Size)
+ {
+ ACPI_WARNING ((Module, Line,
+ "Attempt to allocate zero bytes, allocating 1 byte"));
+ Size = 1;
+ }
+
+ Allocation = AcpiOsAllocateZeroed (Size + sizeof (ACPI_DEBUG_MEM_HEADER));
if (!Allocation)
{
/* Report allocation error */
diff --git a/src/acpica/source/components/utilities/utxface.c b/src/acpica/source/components/utilities/utxface.c
index c1b3c46..3b69560 100644
--- a/src/acpica/source/components/utilities/utxface.c
+++ b/src/acpica/source/components/utilities/utxface.c
@@ -186,7 +186,7 @@ AcpiTerminate (
return_ACPI_STATUS (Status);
}
-ACPI_EXPORT_SYMBOL (AcpiTerminate)
+ACPI_EXPORT_SYMBOL_INIT (AcpiTerminate)
#ifndef ACPI_ASL_COMPILER
diff --git a/src/acpica/source/components/utilities/utxferror.c b/src/acpica/source/components/utilities/utxferror.c
index 3413050..80c1ca7 100644
--- a/src/acpica/source/components/utilities/utxferror.c
+++ b/src/acpica/source/components/utilities/utxferror.c
@@ -114,6 +114,7 @@
*****************************************************************************/
#define __UTXFERROR_C__
+#define EXPORT_ACPI_INTERFACES
#include "acpi.h"
#include "accommon.h"
diff --git a/src/acpica/source/components/utilities/utxfinit.c b/src/acpica/source/components/utilities/utxfinit.c
index a01a1d9..d69adbc 100644
--- a/src/acpica/source/components/utilities/utxfinit.c
+++ b/src/acpica/source/components/utilities/utxfinit.c
@@ -206,7 +206,7 @@ AcpiInitializeSubsystem (
return_ACPI_STATUS (Status);
}
-ACPI_EXPORT_SYMBOL (AcpiInitializeSubsystem)
+ACPI_EXPORT_SYMBOL_INIT (AcpiInitializeSubsystem)
/*******************************************************************************
@@ -328,7 +328,7 @@ AcpiEnableSubsystem (
return_ACPI_STATUS (Status);
}
-ACPI_EXPORT_SYMBOL (AcpiEnableSubsystem)
+ACPI_EXPORT_SYMBOL_INIT (AcpiEnableSubsystem)
/*******************************************************************************
@@ -427,4 +427,4 @@ AcpiInitializeObjects (
return_ACPI_STATUS (Status);
}
-ACPI_EXPORT_SYMBOL (AcpiInitializeObjects)
+ACPI_EXPORT_SYMBOL_INIT (AcpiInitializeObjects)
diff --git a/src/acpica/source/include/acconfig.h b/src/acpica/source/include/acconfig.h
index dd0799a..b9bdab6 100644
--- a/src/acpica/source/include/acconfig.h
+++ b/src/acpica/source/include/acconfig.h
@@ -173,7 +173,9 @@
* ACPI PM timer
* FACS table (Waking vectors and Global Lock)
*/
+#ifndef ACPI_REDUCED_HARDWARE
#define ACPI_REDUCED_HARDWARE FALSE
+#endif
/******************************************************************************
diff --git a/src/acpica/source/include/acdebug.h b/src/acpica/source/include/acdebug.h
index e41495f..a0f720f 100644
--- a/src/acpica/source/include/acdebug.h
+++ b/src/acpica/source/include/acdebug.h
@@ -231,6 +231,10 @@ AcpiDbGenerateGpe (
char *GpeArg,
char *BlockArg))
+ACPI_HW_DEPENDENT_RETURN_VOID (
+void
+AcpiDbGenerateSci (
+ void))
/*
* dbconvert - miscellaneous conversion routines
@@ -306,6 +310,10 @@ AcpiDbDumpNamespace (
char *DepthArg);
void
+AcpiDbDumpNamespacePaths (
+ void);
+
+void
AcpiDbDumpNamespaceByOwner (
char *OwnerArg,
char *DepthArg);
@@ -457,6 +465,10 @@ char *
AcpiDbGetFromHistory (
char *CommandNumArg);
+char *
+AcpiDbGetHistoryByIndex (
+ UINT32 CommanddNum);
+
/*
* dbinput - user front-end to the AML debugger
diff --git a/src/acpica/source/include/acdisasm.h b/src/acpica/source/include/acdisasm.h
index d328c2b..571efce 100644
--- a/src/acpica/source/include/acdisasm.h
+++ b/src/acpica/source/include/acdisasm.h
@@ -766,6 +766,9 @@ void
AcpiDmUnresolvedWarning (
UINT8 Type);
+void
+AcpiDmGetExternalsFromFile (
+ void);
/*
* dmresrc
diff --git a/src/acpica/source/include/acevents.h b/src/acpica/source/include/acevents.h
index 7ffdcc2..3205113 100644
--- a/src/acpica/source/include/acevents.h
+++ b/src/acpica/source/include/acevents.h
@@ -411,17 +411,17 @@ AcpiEvGpeXruptHandler (
void *Context);
UINT32
+AcpiEvSciDispatch (
+ void);
+
+UINT32
AcpiEvInstallSciHandler (
void);
ACPI_STATUS
-AcpiEvRemoveSciHandler (
+AcpiEvRemoveAllSciHandlers (
void);
-UINT32
-AcpiEvInitializeSCI (
- UINT32 ProgramSCI);
-
ACPI_HW_DEPENDENT_RETURN_VOID (
void
AcpiEvTerminate (
diff --git a/src/acpica/source/include/acexcep.h b/src/acpica/source/include/acexcep.h
index 754df74..69feb53 100644
--- a/src/acpica/source/include/acexcep.h
+++ b/src/acpica/source/include/acexcep.h
@@ -199,8 +199,9 @@ typedef struct acpi_exception_info
#define AE_NO_HANDLER EXCEP_ENV (0x001A)
#define AE_OWNER_ID_LIMIT EXCEP_ENV (0x001B)
#define AE_NOT_CONFIGURED EXCEP_ENV (0x001C)
+#define AE_ACCESS EXCEP_ENV (0x001D)
-#define AE_CODE_ENV_MAX 0x001C
+#define AE_CODE_ENV_MAX 0x001D
/*
@@ -307,7 +308,7 @@ static const ACPI_EXCEPTION_INFO AcpiGbl_ExceptionNames_Env[] =
EXCEP_TXT ("AE_NO_ACPI_TABLES", "ACPI tables could not be found"),
EXCEP_TXT ("AE_NO_NAMESPACE", "A namespace has not been loaded"),
EXCEP_TXT ("AE_NO_MEMORY", "Insufficient dynamic memory"),
- EXCEP_TXT ("AE_NOT_FOUND", "The name was not found in the namespace"),
+ EXCEP_TXT ("AE_NOT_FOUND", "A requested entity is not found"),
EXCEP_TXT ("AE_NOT_EXIST", "A required entity does not exist"),
EXCEP_TXT ("AE_ALREADY_EXISTS", "An entity already exists"),
EXCEP_TXT ("AE_TYPE", "The object type is incorrect"),
@@ -330,7 +331,8 @@ static const ACPI_EXCEPTION_INFO AcpiGbl_ExceptionNames_Env[] =
EXCEP_TXT ("AE_SAME_HANDLER", "Attempt was made to install the same handler that is already installed"),
EXCEP_TXT ("AE_NO_HANDLER", "A handler for the operation is not installed"),
EXCEP_TXT ("AE_OWNER_ID_LIMIT", "There are no more Owner IDs available for ACPI tables or control methods"),
- EXCEP_TXT ("AE_NOT_CONFIGURED", "The interface is not part of the current subsystem configuration")
+ EXCEP_TXT ("AE_NOT_CONFIGURED", "The interface is not part of the current subsystem configuration"),
+ EXCEP_TXT ("AE_ACCESS", "Permission denied for the requested operation")
};
static const ACPI_EXCEPTION_INFO AcpiGbl_ExceptionNames_Pgm[] =
diff --git a/src/acpica/source/include/acglobal.h b/src/acpica/source/include/acglobal.h
index 9056b6d..b9ebec5 100644
--- a/src/acpica/source/include/acglobal.h
+++ b/src/acpica/source/include/acglobal.h
@@ -346,6 +346,7 @@ ACPI_EXTERN ACPI_TABLE_HANDLER AcpiGbl_TableHandler;
ACPI_EXTERN void *AcpiGbl_TableHandlerContext;
ACPI_EXTERN ACPI_WALK_STATE *AcpiGbl_BreakpointWalk;
ACPI_EXTERN ACPI_INTERFACE_HANDLER AcpiGbl_InterfaceHandler;
+ACPI_EXTERN ACPI_SCI_HANDLER_INFO *AcpiGbl_SciHandlerList;
/* Owner ID support */
@@ -525,13 +526,6 @@ ACPI_EXTERN BOOLEAN AcpiGbl_DbOpt_tables;
ACPI_EXTERN BOOLEAN AcpiGbl_DbOpt_stats;
ACPI_EXTERN BOOLEAN AcpiGbl_DbOpt_ini_methods;
ACPI_EXTERN BOOLEAN AcpiGbl_DbOpt_NoRegionSupport;
-
-ACPI_EXTERN char *AcpiGbl_DbArgs[ACPI_DEBUGGER_MAX_ARGS];
-ACPI_EXTERN ACPI_OBJECT_TYPE AcpiGbl_DbArgTypes[ACPI_DEBUGGER_MAX_ARGS];
-ACPI_EXTERN char AcpiGbl_DbLineBuf[ACPI_DB_LINE_BUFFER_SIZE];
-ACPI_EXTERN char AcpiGbl_DbParsedBuf[ACPI_DB_LINE_BUFFER_SIZE];
-ACPI_EXTERN char AcpiGbl_DbScopeBuf[80];
-ACPI_EXTERN char AcpiGbl_DbDebugFilename[80];
ACPI_EXTERN BOOLEAN AcpiGbl_DbOutputToFile;
ACPI_EXTERN char *AcpiGbl_DbBuffer;
ACPI_EXTERN char *AcpiGbl_DbFilename;
@@ -539,6 +533,16 @@ ACPI_EXTERN UINT32 AcpiGbl_DbDebugLevel;
ACPI_EXTERN UINT32 AcpiGbl_DbConsoleDebugLevel;
ACPI_EXTERN ACPI_NAMESPACE_NODE *AcpiGbl_DbScopeNode;
+ACPI_EXTERN char *AcpiGbl_DbArgs[ACPI_DEBUGGER_MAX_ARGS];
+ACPI_EXTERN ACPI_OBJECT_TYPE AcpiGbl_DbArgTypes[ACPI_DEBUGGER_MAX_ARGS];
+
+/* These buffers should all be the same size */
+
+ACPI_EXTERN char AcpiGbl_DbLineBuf[ACPI_DB_LINE_BUFFER_SIZE];
+ACPI_EXTERN char AcpiGbl_DbParsedBuf[ACPI_DB_LINE_BUFFER_SIZE];
+ACPI_EXTERN char AcpiGbl_DbScopeBuf[ACPI_DB_LINE_BUFFER_SIZE];
+ACPI_EXTERN char AcpiGbl_DbDebugFilename[ACPI_DB_LINE_BUFFER_SIZE];
+
/*
* Statistic globals
*/
diff --git a/src/acpica/source/include/aclocal.h b/src/acpica/source/include/aclocal.h
index e45b9f5..37c46b2 100644
--- a/src/acpica/source/include/aclocal.h
+++ b/src/acpica/source/include/aclocal.h
@@ -525,6 +525,16 @@ typedef struct acpi_simple_repair_info
*
****************************************************************************/
+/* Dispatch info for each host-installed SCI handler */
+
+typedef struct acpi_sci_handler_info
+{
+ struct acpi_sci_handler_info *Next;
+ ACPI_SCI_HANDLER Address; /* Address of handler */
+ void *Context; /* Context to be passed to handler */
+
+} ACPI_SCI_HANDLER_INFO;
+
/* Dispatch info for each GPE -- either a method or handler, cannot be both */
typedef struct acpi_gpe_handler_info
@@ -1289,7 +1299,8 @@ typedef struct acpi_external_list
/* Values for Flags field above */
-#define ACPI_IPATH_ALLOCATED 0x01
+#define ACPI_IPATH_ALLOCATED 0x01
+#define ACPI_FROM_REFERENCE_FILE 0x02
typedef struct acpi_external_file
@@ -1320,7 +1331,7 @@ typedef struct acpi_db_method_info
char *Name;
UINT32 Flags;
UINT32 NumLoops;
- char Pathname[128];
+ char Pathname[ACPI_DB_LINE_BUFFER_SIZE];
char **Args;
ACPI_OBJECT_TYPE *Types;
@@ -1347,6 +1358,7 @@ typedef struct acpi_integrity_info
} ACPI_INTEGRITY_INFO;
+#define ACPI_DB_DISABLE_OUTPUT 0x00
#define ACPI_DB_REDIRECTABLE_OUTPUT 0x01
#define ACPI_DB_CONSOLE_OUTPUT 0x02
#define ACPI_DB_DUPLICATE_OUTPUT 0x03
diff --git a/src/acpica/source/include/acmacros.h b/src/acpica/source/include/acmacros.h
index f53c317..67fd89c 100644
--- a/src/acpica/source/include/acmacros.h
+++ b/src/acpica/source/include/acmacros.h
@@ -487,32 +487,6 @@
/*
- * Memory allocation tracking (DEBUG ONLY)
- */
-#define ACPI_MEM_PARAMETERS _COMPONENT, _AcpiModuleName, __LINE__
-
-#ifndef ACPI_DBG_TRACK_ALLOCATIONS
-
-/* Memory allocation */
-
-#define ACPI_ALLOCATE(a) AcpiUtAllocate((ACPI_SIZE) (a), ACPI_MEM_PARAMETERS)
-#define ACPI_ALLOCATE_ZEROED(a) AcpiUtAllocateZeroed((ACPI_SIZE) (a), ACPI_MEM_PARAMETERS)
-#define ACPI_FREE(a) AcpiOsFree(a)
-#define ACPI_MEM_TRACKING(a)
-
-#else
-
-/* Memory allocation */
-
-#define ACPI_ALLOCATE(a) AcpiUtAllocateAndTrack((ACPI_SIZE) (a), ACPI_MEM_PARAMETERS)
-#define ACPI_ALLOCATE_ZEROED(a) AcpiUtAllocateZeroedAndTrack((ACPI_SIZE) (a), ACPI_MEM_PARAMETERS)
-#define ACPI_FREE(a) AcpiUtFreeAndTrack(a, ACPI_MEM_PARAMETERS)
-#define ACPI_MEM_TRACKING(a) a
-
-#endif /* ACPI_DBG_TRACK_ALLOCATIONS */
-
-
-/*
* Macros used for ACPICA utilities only
*/
diff --git a/src/acpica/source/include/acnames.h b/src/acpica/source/include/acnames.h
index f9e651b..99eb36a 100644
--- a/src/acpica/source/include/acnames.h
+++ b/src/acpica/source/include/acnames.h
@@ -118,24 +118,25 @@
/* Method names - these methods can appear anywhere in the namespace */
-#define METHOD_NAME__SB_ "_SB_"
-#define METHOD_NAME__HID "_HID"
-#define METHOD_NAME__CID "_CID"
-#define METHOD_NAME__UID "_UID"
-#define METHOD_NAME__SUB "_SUB"
#define METHOD_NAME__ADR "_ADR"
-#define METHOD_NAME__INI "_INI"
-#define METHOD_NAME__STA "_STA"
-#define METHOD_NAME__REG "_REG"
-#define METHOD_NAME__SEG "_SEG"
+#define METHOD_NAME__AEI "_AEI"
#define METHOD_NAME__BBN "_BBN"
-#define METHOD_NAME__PRT "_PRT"
+#define METHOD_NAME__CBA "_CBA"
+#define METHOD_NAME__CID "_CID"
#define METHOD_NAME__CRS "_CRS"
+#define METHOD_NAME__HID "_HID"
+#define METHOD_NAME__INI "_INI"
+#define METHOD_NAME__PLD "_PLD"
#define METHOD_NAME__PRS "_PRS"
-#define METHOD_NAME__AEI "_AEI"
+#define METHOD_NAME__PRT "_PRT"
#define METHOD_NAME__PRW "_PRW"
+#define METHOD_NAME__REG "_REG"
+#define METHOD_NAME__SB_ "_SB_"
+#define METHOD_NAME__SEG "_SEG"
#define METHOD_NAME__SRS "_SRS"
-#define METHOD_NAME__PLD "_PLD"
+#define METHOD_NAME__STA "_STA"
+#define METHOD_NAME__SUB "_SUB"
+#define METHOD_NAME__UID "_UID"
/* Method names - these methods must appear at the namespace root */
diff --git a/src/acpica/source/include/acnamesp.h b/src/acpica/source/include/acnamesp.h
index 74575ba..7489e59 100644
--- a/src/acpica/source/include/acnamesp.h
+++ b/src/acpica/source/include/acnamesp.h
@@ -344,6 +344,14 @@ AcpiNsDumpObjects (
ACPI_OWNER_ID OwnerId,
ACPI_HANDLE StartHandle);
+void
+AcpiNsDumpObjectPaths (
+ ACPI_OBJECT_TYPE Type,
+ UINT8 DisplayType,
+ UINT32 MaxDepth,
+ ACPI_OWNER_ID OwnerId,
+ ACPI_HANDLE StartHandle);
+
/*
* nseval - Namespace evaluation functions
diff --git a/src/acpica/source/include/acpiosxf.h b/src/acpica/source/include/acpiosxf.h
index 32578fe..627c59e 100644
--- a/src/acpica/source/include/acpiosxf.h
+++ b/src/acpica/source/include/acpiosxf.h
@@ -6,7 +6,6 @@
*
*****************************************************************************/
-
/******************************************************************************
*
* 1. Copyright Notice
@@ -32,8 +31,7 @@
* 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 exer
- se the above copyright
+ * 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;
@@ -158,85 +156,111 @@ typedef struct acpi_signal_fatal_info
/*
* OSL Initialization and shutdown primitives
*/
+#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsInitialize
ACPI_STATUS
AcpiOsInitialize (
void);
+#endif
+#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsTerminate
ACPI_STATUS
AcpiOsTerminate (
void);
+#endif
/*
* ACPI Table interfaces
*/
+#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsGetRootPointer
ACPI_PHYSICAL_ADDRESS
AcpiOsGetRootPointer (
void);
+#endif
+#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsPredefinedOverride
ACPI_STATUS
AcpiOsPredefinedOverride (
const ACPI_PREDEFINED_NAMES *InitVal,
ACPI_STRING *NewVal);
+#endif
+#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsTableOverride
ACPI_STATUS
AcpiOsTableOverride (
ACPI_TABLE_HEADER *ExistingTable,
ACPI_TABLE_HEADER **NewTable);
+#endif
+#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsPhysicalTableOverride
ACPI_STATUS
AcpiOsPhysicalTableOverride (
ACPI_TABLE_HEADER *ExistingTable,
ACPI_PHYSICAL_ADDRESS *NewAddress,
UINT32 *NewTableLength);
+#endif
/*
* Spinlock primitives
*/
-#ifndef AcpiOsCreateLock
+#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsCreateLock
ACPI_STATUS
AcpiOsCreateLock (
ACPI_SPINLOCK *OutHandle);
#endif
+#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsDeleteLock
void
AcpiOsDeleteLock (
ACPI_SPINLOCK Handle);
+#endif
+#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsAcquireLock
ACPI_CPU_FLAGS
AcpiOsAcquireLock (
ACPI_SPINLOCK Handle);
+#endif
+#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsReleaseLock
void
AcpiOsReleaseLock (
ACPI_SPINLOCK Handle,
ACPI_CPU_FLAGS Flags);
+#endif
/*
* Semaphore primitives
*/
+#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsCreateSemaphore
ACPI_STATUS
AcpiOsCreateSemaphore (
UINT32 MaxUnits,
UINT32 InitialUnits,
ACPI_SEMAPHORE *OutHandle);
+#endif
+#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsDeleteSemaphore
ACPI_STATUS
AcpiOsDeleteSemaphore (
ACPI_SEMAPHORE Handle);
+#endif
+#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsWaitSemaphore
ACPI_STATUS
AcpiOsWaitSemaphore (
ACPI_SEMAPHORE Handle,
UINT32 Units,
UINT16 Timeout);
+#endif
+#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsSignalSemaphore
ACPI_STATUS
AcpiOsSignalSemaphore (
ACPI_SEMAPHORE Handle,
UINT32 Units);
+#endif
/*
@@ -245,151 +269,208 @@ AcpiOsSignalSemaphore (
*/
#if (ACPI_MUTEX_TYPE != ACPI_BINARY_SEMAPHORE)
+#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsCreateMutex
ACPI_STATUS
AcpiOsCreateMutex (
ACPI_MUTEX *OutHandle);
+#endif
+#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsDeleteMutex
void
AcpiOsDeleteMutex (
ACPI_MUTEX Handle);
+#endif
+#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsAcquireMutex
ACPI_STATUS
AcpiOsAcquireMutex (
ACPI_MUTEX Handle,
UINT16 Timeout);
+#endif
+#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsReleaseMutex
void
AcpiOsReleaseMutex (
ACPI_MUTEX Handle);
#endif
+#endif
+
/*
* Memory allocation and mapping
*/
+#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsAllocate
void *
AcpiOsAllocate (
ACPI_SIZE Size);
+#endif
+#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsAllocateZeroed
+void *
+AcpiOsAllocateZeroed (
+ ACPI_SIZE Size);
+#endif
+
+#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsFree
void
AcpiOsFree (
void * Memory);
+#endif
+#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsMapMemory
void *
AcpiOsMapMemory (
ACPI_PHYSICAL_ADDRESS Where,
ACPI_SIZE Length);
+#endif
+#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsUnmapMemory
void
AcpiOsUnmapMemory (
void *LogicalAddress,
ACPI_SIZE Size);
+#endif
+#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsGetPhysicalAddress
ACPI_STATUS
AcpiOsGetPhysicalAddress (
void *LogicalAddress,
ACPI_PHYSICAL_ADDRESS *PhysicalAddress);
+#endif
/*
* Memory/Object Cache
*/
+#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsCreateCache
ACPI_STATUS
AcpiOsCreateCache (
char *CacheName,
UINT16 ObjectSize,
UINT16 MaxDepth,
ACPI_CACHE_T **ReturnCache);
+#endif
+#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsDeleteCache
ACPI_STATUS
AcpiOsDeleteCache (
ACPI_CACHE_T *Cache);
+#endif
+#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsPurgeCache
ACPI_STATUS
AcpiOsPurgeCache (
ACPI_CACHE_T *Cache);
+#endif
+#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsAcquireObject
void *
AcpiOsAcquireObject (
ACPI_CACHE_T *Cache);
+#endif
+#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsReleaseObject
ACPI_STATUS
AcpiOsReleaseObject (
ACPI_CACHE_T *Cache,
void *Object);
+#endif
/*
* Interrupt handlers
*/
+#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsInstallInterruptHandler
ACPI_STATUS
AcpiOsInstallInterruptHandler (
UINT32 InterruptNumber,
ACPI_OSD_HANDLER ServiceRoutine,
void *Context);
+#endif
+#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsRemoveInterruptHandler
ACPI_STATUS
AcpiOsRemoveInterruptHandler (
UINT32 InterruptNumber,
ACPI_OSD_HANDLER ServiceRoutine);
+#endif
/*
* Threads and Scheduling
*/
+#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsGetThreadId
ACPI_THREAD_ID
AcpiOsGetThreadId (
void);
+#endif
+#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsExecute
ACPI_STATUS
AcpiOsExecute (
ACPI_EXECUTE_TYPE Type,
ACPI_OSD_EXEC_CALLBACK Function,
void *Context);
+#endif
+#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsWaitEventsComplete
void
AcpiOsWaitEventsComplete (
void);
+#endif
+#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsSleep
void
AcpiOsSleep (
UINT64 Milliseconds);
+#endif
+#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsStall
void
AcpiOsStall (
UINT32 Microseconds);
+#endif
/*
* Platform and hardware-independent I/O interfaces
*/
+#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsReadPort
ACPI_STATUS
AcpiOsReadPort (
ACPI_IO_ADDRESS Address,
UINT32 *Value,
UINT32 Width);
+#endif
+#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsWritePort
ACPI_STATUS
AcpiOsWritePort (
ACPI_IO_ADDRESS Address,
UINT32 Value,
UINT32 Width);
+#endif
/*
* Platform and hardware-independent physical memory interfaces
*/
+#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsReadMemory
ACPI_STATUS
AcpiOsReadMemory (
ACPI_PHYSICAL_ADDRESS Address,
UINT64 *Value,
UINT32 Width);
+#endif
+#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsWriteMemory
ACPI_STATUS
AcpiOsWriteMemory (
ACPI_PHYSICAL_ADDRESS Address,
UINT64 Value,
UINT32 Width);
+#endif
/*
@@ -397,102 +478,131 @@ AcpiOsWriteMemory (
* Note: Can't use "Register" as a parameter, changed to "Reg" --
* certain compilers complain.
*/
+#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsReadPciConfiguration
ACPI_STATUS
AcpiOsReadPciConfiguration (
ACPI_PCI_ID *PciId,
UINT32 Reg,
UINT64 *Value,
UINT32 Width);
+#endif
+#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsWritePciConfiguration
ACPI_STATUS
AcpiOsWritePciConfiguration (
ACPI_PCI_ID *PciId,
UINT32 Reg,
UINT64 Value,
UINT32 Width);
+#endif
/*
* Miscellaneous
*/
+#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsReadable
BOOLEAN
AcpiOsReadable (
void *Pointer,
ACPI_SIZE Length);
+#endif
+#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsWritable
BOOLEAN
AcpiOsWritable (
void *Pointer,
ACPI_SIZE Length);
+#endif
+#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsGetTimer
UINT64
AcpiOsGetTimer (
void);
+#endif
+#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsSignal
ACPI_STATUS
AcpiOsSignal (
UINT32 Function,
void *Info);
+#endif
/*
* Debug print routines
*/
+#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsPrintf
void ACPI_INTERNAL_VAR_XFACE
AcpiOsPrintf (
const char *Format,
...);
+#endif
+#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsVprintf
void
AcpiOsVprintf (
const char *Format,
va_list Args);
+#endif
+#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsRedirectOutput
void
AcpiOsRedirectOutput (
void *Destination);
+#endif
/*
* Debug input
*/
+#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsGetLine
ACPI_STATUS
AcpiOsGetLine (
char *Buffer,
UINT32 BufferLength,
UINT32 *BytesRead);
+#endif
/*
* Obtain ACPI table(s)
*/
+#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsGetTableByName
ACPI_STATUS
AcpiOsGetTableByName (
char *Signature,
UINT32 Instance,
ACPI_TABLE_HEADER **Table,
ACPI_PHYSICAL_ADDRESS *Address);
+#endif
+#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsGetTableByIndex
ACPI_STATUS
AcpiOsGetTableByIndex (
UINT32 Index,
ACPI_TABLE_HEADER **Table,
+ UINT32 *Instance,
ACPI_PHYSICAL_ADDRESS *Address);
+#endif
+#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsGetTableByAddress
ACPI_STATUS
AcpiOsGetTableByAddress (
ACPI_PHYSICAL_ADDRESS Address,
ACPI_TABLE_HEADER **Table);
+#endif
/*
* Directory manipulation
*/
+#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsOpenDirectory
void *
AcpiOsOpenDirectory (
char *Pathname,
char *WildcardSpec,
char RequestedFileType);
+#endif
/* RequesteFileType values */
@@ -500,13 +610,17 @@ AcpiOsOpenDirectory (
#define REQUEST_DIR_ONLY 1
+#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsGetNextFilename
char *
AcpiOsGetNextFilename (
void *DirHandle);
+#endif
+#ifndef ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsCloseDirectory
void
AcpiOsCloseDirectory (
void *DirHandle);
+#endif
#endif /* __ACPIOSXF_H__ */
diff --git a/src/acpica/source/include/acpixf.h b/src/acpica/source/include/acpixf.h
index 3971f57..cbcf400 100644
--- a/src/acpica/source/include/acpixf.h
+++ b/src/acpica/source/include/acpixf.h
@@ -119,7 +119,7 @@
/* Current ACPICA subsystem version in YYYYMMDD format */
-#define ACPI_CA_VERSION 0x20130725
+#define ACPI_CA_VERSION 0x20130927
#include "acconfig.h"
#include "actypes.h"
@@ -178,7 +178,7 @@ extern UINT8 AcpiGbl_DisableSsdtTableLoad;
static ACPI_INLINE Prototype {return(AE_OK);}
#define ACPI_HW_DEPENDENT_RETURN_VOID(Prototype) \
- static ACPI_INLINE Prototype {}
+ static ACPI_INLINE Prototype {return;}
#endif /* !ACPI_REDUCED_HARDWARE */
@@ -267,21 +267,6 @@ AcpiDecodePldBuffer (
ACPI_SIZE Length,
ACPI_PLD_INFO **ReturnBuffer);
-/*
- * ACPI Memory management
- */
-void *
-AcpiAllocate (
- UINT32 Size);
-
-void *
-AcpiCallocate (
- UINT32 Size);
-
-void
-AcpiFree (
- void *Address);
-
/*
* ACPI table load/unload interfaces
@@ -449,6 +434,17 @@ AcpiInstallInitializationHandler (
ACPI_HW_DEPENDENT_RETURN_STATUS (
ACPI_STATUS
+AcpiInstallSciHandler (
+ ACPI_SCI_HANDLER Address,
+ void *Context))
+
+ACPI_HW_DEPENDENT_RETURN_STATUS (
+ACPI_STATUS
+AcpiRemoveSciHandler (
+ ACPI_SCI_HANDLER Address))
+
+ACPI_HW_DEPENDENT_RETURN_STATUS (
+ACPI_STATUS
AcpiInstallGlobalEventHandler (
ACPI_GBL_EVENT_HANDLER Handler,
void *Context))
@@ -827,48 +823,54 @@ AcpiGetTimerDuration (
/*
* Error/Warning output
*/
+ACPI_PRINTF_LIKE(3)
void ACPI_INTERNAL_VAR_XFACE
AcpiError (
const char *ModuleName,
UINT32 LineNumber,
const char *Format,
- ...) ACPI_PRINTF_LIKE(3);
+ ...);
+ACPI_PRINTF_LIKE(4)
void ACPI_INTERNAL_VAR_XFACE
AcpiException (
const char *ModuleName,
UINT32 LineNumber,
ACPI_STATUS Status,
const char *Format,
- ...) ACPI_PRINTF_LIKE(4);
+ ...);
+ACPI_PRINTF_LIKE(3)
void ACPI_INTERNAL_VAR_XFACE
AcpiWarning (
const char *ModuleName,
UINT32 LineNumber,
const char *Format,
- ...) ACPI_PRINTF_LIKE(3);
+ ...);
+ACPI_PRINTF_LIKE(3)
void ACPI_INTERNAL_VAR_XFACE
AcpiInfo (
const char *ModuleName,
UINT32 LineNumber,
const char *Format,
- ...) ACPI_PRINTF_LIKE(3);
+ ...);
+ACPI_PRINTF_LIKE(3)
void ACPI_INTERNAL_VAR_XFACE
AcpiBiosError (
const char *ModuleName,
UINT32 LineNumber,
const char *Format,
- ...) ACPI_PRINTF_LIKE(3);
+ ...);
+ACPI_PRINTF_LIKE(3)
void ACPI_INTERNAL_VAR_XFACE
AcpiBiosWarning (
const char *ModuleName,
UINT32 LineNumber,
const char *Format,
- ...) ACPI_PRINTF_LIKE(3);
+ ...);
/*
@@ -876,6 +878,7 @@ AcpiBiosWarning (
*/
#ifdef ACPI_DEBUG_OUTPUT
+ACPI_PRINTF_LIKE(6)
void ACPI_INTERNAL_VAR_XFACE
AcpiDebugPrint (
UINT32 RequestedDebugLevel,
@@ -884,8 +887,9 @@ AcpiDebugPrint (
const char *ModuleName,
UINT32 ComponentId,
const char *Format,
- ...) ACPI_PRINTF_LIKE(6);
+ ...);
+ACPI_PRINTF_LIKE(6)
void ACPI_INTERNAL_VAR_XFACE
AcpiDebugPrintRaw (
UINT32 RequestedDebugLevel,
@@ -894,7 +898,7 @@ AcpiDebugPrintRaw (
const char *ModuleName,
UINT32 ComponentId,
const char *Format,
- ...) ACPI_PRINTF_LIKE(6);
+ ...);
#endif
#endif /* __ACXFACE_H__ */
diff --git a/src/acpica/source/include/actypes.h b/src/acpica/source/include/actypes.h
index efe1e91..072b946 100644
--- a/src/acpica/source/include/actypes.h
+++ b/src/acpica/source/include/actypes.h
@@ -375,9 +375,18 @@ typedef UINT32 ACPI_PHYSICAL_ADDRESS;
#endif
/*
- * All ACPICA functions that are available to the rest of the kernel are
- * tagged with this macro which can be defined as appropriate for the host.
+ * All ACPICA external functions that are available to the rest of the kernel
+ * are tagged with thes macros which can be defined as appropriate for the host.
+ *
+ * Notes:
+ * ACPI_EXPORT_SYMBOL_INIT is used for initialization and termination
+ * interfaces that may need special processing.
+ * ACPI_EXPORT_SYMBOL is used for all other public external functions.
*/
+#ifndef ACPI_EXPORT_SYMBOL_INIT
+#define ACPI_EXPORT_SYMBOL_INIT(Symbol)
+#endif
+
#ifndef ACPI_EXPORT_SYMBOL
#define ACPI_EXPORT_SYMBOL(Symbol)
#endif
@@ -391,6 +400,34 @@ typedef UINT32 ACPI_PHYSICAL_ADDRESS;
#endif
+/*******************************************************************************
+ *
+ * Configuration
+ *
+ ******************************************************************************/
+
+#ifdef ACPI_DBG_TRACK_ALLOCATIONS
+/*
+ * Memory allocation tracking (used by AcpiExec to detect memory leaks)
+ */
+#define ACPI_MEM_PARAMETERS _COMPONENT, _AcpiModuleName, __LINE__
+#define ACPI_ALLOCATE(a) AcpiUtAllocateAndTrack ((ACPI_SIZE) (a), ACPI_MEM_PARAMETERS)
+#define ACPI_ALLOCATE_ZEROED(a) AcpiUtAllocateZeroedAndTrack ((ACPI_SIZE) (a), ACPI_MEM_PARAMETERS)
+#define ACPI_FREE(a) AcpiUtFreeAndTrack (a, ACPI_MEM_PARAMETERS)
+#define ACPI_MEM_TRACKING(a) a
+
+#else
+/*
+ * Normal memory allocation directly via the OS services layer
+ */
+#define ACPI_ALLOCATE(a) AcpiOsAllocate ((ACPI_SIZE) (a))
+#define ACPI_ALLOCATE_ZEROED(a) AcpiOsAllocateZeroed ((ACPI_SIZE) (a))
+#define ACPI_FREE(a) AcpiOsFree (a)
+#define ACPI_MEM_TRACKING(a)
+
+#endif /* ACPI_DBG_TRACK_ALLOCATIONS */
+
+
/******************************************************************************
*
* ACPI Specification constants (Do not change unless the specification changes)
@@ -407,6 +444,7 @@ typedef UINT32 ACPI_PHYSICAL_ADDRESS;
#define ACPI_PM1_REGISTER_WIDTH 16
#define ACPI_PM2_REGISTER_WIDTH 8
#define ACPI_PM_TIMER_WIDTH 32
+#define ACPI_RESET_REGISTER_WIDTH 8
/* Names within the namespace are 4 bytes long */
@@ -560,6 +598,11 @@ typedef UINT64 ACPI_INTEGER;
#define ACPI_MOVE_NAME(dest,src) (ACPI_STRNCPY (ACPI_CAST_PTR (char, (dest)), ACPI_CAST_PTR (char, (src)), ACPI_NAME_SIZE))
#endif
+/* Support for the special RSDP signature (8 characters) */
+
+#define ACPI_VALIDATE_RSDP_SIG(a) (!ACPI_STRNCMP (ACPI_CAST_PTR (char, (a)), ACPI_SIG_RSDP, 8))
+#define ACPI_MAKE_RSDP_SIG(dest) (ACPI_MEMCPY (ACPI_CAST_PTR (char, (dest)), ACPI_SIG_RSDP, 8))
+
/*******************************************************************************
*
@@ -1078,6 +1121,10 @@ typedef void
* Various handlers and callback procedures
*/
typedef
+UINT32 (*ACPI_SCI_HANDLER) (
+ void *Context);
+
+typedef
void (*ACPI_GBL_EVENT_HANDLER) (
UINT32 EventType,
ACPI_HANDLE Device,
diff --git a/src/acpica/source/include/acutils.h b/src/acpica/source/include/acutils.h
index e6ae828..442600d 100644
--- a/src/acpica/source/include/acutils.h
+++ b/src/acpica/source/include/acutils.h
@@ -998,6 +998,27 @@ void
AcpiUtRepairName (
char *Name);
+#if defined (ACPI_DEBUGGER) || defined (ACPI_APPLICATION)
+BOOLEAN
+AcpiUtSafeStrcpy (
+ char *Dest,
+ ACPI_SIZE DestSize,
+ char *Source);
+
+BOOLEAN
+AcpiUtSafeStrcat (
+ char *Dest,
+ ACPI_SIZE DestSize,
+ char *Source);
+
+BOOLEAN
+AcpiUtSafeStrncat (
+ char *Dest,
+ ACPI_SIZE DestSize,
+ char *Source,
+ ACPI_SIZE MaxTransferLength);
+#endif
+
/*
* utmutex - mutex support
@@ -1039,20 +1060,6 @@ AcpiUtInitializeBuffer (
ACPI_BUFFER *Buffer,
ACPI_SIZE RequiredLength);
-void *
-AcpiUtAllocate (
- ACPI_SIZE Size,
- UINT32 Component,
- const char *Module,
- UINT32 Line);
-
-void *
-AcpiUtAllocateZeroed (
- ACPI_SIZE Size,
- UINT32 Component,
- const char *Module,
- UINT32 Line);
-
#ifdef ACPI_DBG_TRACK_ALLOCATIONS
void *
AcpiUtAllocateAndTrack (
diff --git a/src/acpica/source/include/platform/acgcc.h b/src/acpica/source/include/platform/acgcc.h
index 6ff7743..2c7bd0b 100644
--- a/src/acpica/source/include/platform/acgcc.h
+++ b/src/acpica/source/include/platform/acgcc.h
@@ -120,7 +120,7 @@
/* Function name is used for debug output. Non-ANSI, compiler-dependent */
-#define ACPI_GET_FUNCTION_NAME __FUNCTION__
+#define ACPI_GET_FUNCTION_NAME __func__
/*
* This macro is used to tag functions as "printf-like" because
diff --git a/src/acpica/source/include/platform/aclinux.h b/src/acpica/source/include/platform/aclinux.h
index 1177c84..15c1748 100644
--- a/src/acpica/source/include/platform/aclinux.h
+++ b/src/acpica/source/include/platform/aclinux.h
@@ -183,13 +183,22 @@
#ifdef __KERNEL__
#include <acpi/actypes.h>
+
+ACPI_STATUS __init AcpiOsInitialize (
+ void);
+#define ACPI_USE_NATIVE_DECLARED_AcpiOsInitialize
+
+ACPI_STATUS __exit AcpiOsTerminate (
+ void);
+#define ACPI_USE_NATIVE_DECLARED_AcpiOsTerminate
+
/*
- * Overrides for in-kernel ACPICA
+ * Memory allocation/deallocation
*/
-static inline acpi_thread_id acpi_os_get_thread_id(void)
-{
- return (ACPI_THREAD_ID) (unsigned long) current;
-}
+
+/* Use native linux version of acpi_os_allocate_zeroed */
+
+#define USE_NATIVE_ALLOCATE_ZEROED
/*
* The irqs_disabled() check is for resume from RAM.
@@ -197,25 +206,49 @@ static inline acpi_thread_id acpi_os_get_thread_id(void)
* However, boot has (system_state != SYSTEM_RUNNING)
* to quiet __might_sleep() in kmalloc() and resume does not.
*/
-static inline void *acpi_os_allocate(acpi_size size)
+static inline void *
+AcpiOsAllocate (
+ ACPI_SIZE Size)
{
- return kmalloc(size, irqs_disabled() ? GFP_ATOMIC : GFP_KERNEL);
+ return kmalloc (Size, irqs_disabled () ? GFP_ATOMIC : GFP_KERNEL);
}
+#define ACPI_USE_NATIVE_DECLARED_AcpiOsAllocate
-static inline void *acpi_os_allocate_zeroed(acpi_size size)
+static inline void *
+AcpiOsAllocateZeroed (
+ ACPI_SIZE Size)
{
- return kzalloc(size, irqs_disabled() ? GFP_ATOMIC : GFP_KERNEL);
+ return kzalloc (Size, irqs_disabled () ? GFP_ATOMIC : GFP_KERNEL);
}
+#define ACPI_USE_NATIVE_DECLARED_AcpiOsAllocateZeroed
-static inline void *acpi_os_acquire_object(acpi_cache_t * cache)
+static inline void
+AcpiOsFree (
+ void *Memory)
{
- return kmem_cache_zalloc(cache,
- irqs_disabled() ? GFP_ATOMIC : GFP_KERNEL);
+ kfree (Memory);
}
+#define ACPI_USE_NATIVE_DECLARED_AcpiOsFree
-#define ACPI_ALLOCATE(a) acpi_os_allocate(a)
-#define ACPI_ALLOCATE_ZEROED(a) acpi_os_allocate_zeroed(a)
-#define ACPI_FREE(a) kfree(a)
+static inline void *
+AcpiOsAcquireObject (
+ ACPI_CACHE_T *Cache)
+{
+ return kmem_cache_zalloc (Cache,
+ irqs_disabled () ? GFP_ATOMIC : GFP_KERNEL);
+}
+#define ACPI_USE_NATIVE_DECLARED_AcpiOsAcquireObject
+
+/*
+ * Overrides for in-kernel ACPICA
+ */
+static inline ACPI_THREAD_ID
+AcpiOsGetThreadId (
+ void)
+{
+ return (ACPI_THREAD_ID) (unsigned long) current;
+}
+#define ACPI_USE_NATIVE_DECLARED_AcpiOsGetThreadId
#ifndef CONFIG_PREEMPT
/*
@@ -236,16 +269,48 @@ static inline void *acpi_os_acquire_object(acpi_cache_t * cache)
* all locks to the name of the argument of acpi_os_create_lock(), which
* prevents lockdep from reporting false positives for ACPICA locks.
*/
-#define AcpiOsCreateLock(__handle) \
-({ \
- spinlock_t *lock = ACPI_ALLOCATE(sizeof(*lock)); \
- \
- if (lock) { \
- *(__handle) = lock; \
- spin_lock_init(*(__handle)); \
- } \
- lock ? AE_OK : AE_NO_MEMORY; \
+#define AcpiOsCreateLock(__Handle) \
+({ \
+ spinlock_t *Lock = ACPI_ALLOCATE(sizeof(*Lock)); \
+ if (Lock) { \
+ *(__Handle) = Lock; \
+ spin_lock_init(*(__Handle)); \
+ } \
+ Lock ? AE_OK : AE_NO_MEMORY; \
})
+#define ACPI_USE_NATIVE_DECLARED_AcpiOsCreateLock
+
+void __iomem *
+AcpiOsMapMemory (
+ ACPI_PHYSICAL_ADDRESS Where,
+ ACPI_SIZE Length);
+#define ACPI_USE_NATIVE_DECLARED_AcpiOsMapMemory
+
+void
+AcpiOsUnmapMemory (
+ void __iomem *LogicalAddress,
+ ACPI_SIZE Size);
+#define ACPI_USE_NATIVE_DECLARED_AcpiOsUnmapMemory
+
+/* OSL interfaces used by debugger/disassembler */
+#define ACPI_USE_NATIVE_DECLARED_AcpiOsReadable
+#define ACPI_USE_NATIVE_DECLARED_AcpiOsWritable
+
+/* OSL interfaces used by utilities */
+#define ACPI_USE_NATIVE_DECLARED_AcpiOsRedirectOutput
+#define ACPI_USE_NATIVE_DECLARED_AcpiOsGetLine
+#define ACPI_USE_NATIVE_DECLARED_AcpiOsGetTableByName
+#define ACPI_USE_NATIVE_DECLARED_AcpiOsGetTableByIndex
+#define ACPI_USE_NATIVE_DECLARED_AcpiOsGetTableByAddress
+#define ACPI_USE_NATIVE_DECLARED_AcpiOsOpenDirectory
+#define ACPI_USE_NATIVE_DECLARED_AcpiOsGetNextFilename
+#define ACPI_USE_NATIVE_DECLARED_AcpiOsCloseDirectory
+
+/* OSL interfaces added by Linux */
+
+#ifdef EXPORT_ACPI_INTERFACES
+#include <linux/export.h>
+#endif
#endif /* __KERNEL__ */
diff --git a/src/acpica/source/os_specific/service_layers/osunixxf.c b/src/acpica/source/os_specific/service_layers/osunixxf.c
index 4be7b9b..7aa4168 100644
--- a/src/acpica/source/os_specific/service_layers/osunixxf.c
+++ b/src/acpica/source/os_specific/service_layers/osunixxf.c
@@ -139,6 +139,7 @@
extern FILE *AcpiGbl_DebugFile;
FILE *AcpiGbl_OutputFile;
+BOOLEAN AcpiGbl_DebugTimeout = FALSE;
/* Upcalls to AcpiExec */
@@ -156,7 +157,101 @@ typedef void* (*PTHREAD_CALLBACK) (void *);
/* Buffer used by AcpiOsVprintf */
-#define ACPI_VPRINTF_BUFFER_SIZE 512
+#define ACPI_VPRINTF_BUFFER_SIZE 512
+#define _ASCII_NEWLINE '\n'
+
+/* Terminal support for AcpiExec only */
+
+#ifdef ACPI_EXEC_APP
+#include <termio.h>
+
+struct termios OriginalTermAttributes;
+
+ACPI_STATUS
+AcpiUtReadLine (
+ char *Buffer,
+ UINT32 BufferLength,
+ UINT32 *BytesRead);
+
+static void
+OsEnterLineEditMode (
+ void);
+
+static void
+OsExitLineEditMode (
+ void);
+
+
+/******************************************************************************
+ *
+ * FUNCTION: OsEnterLineEditMode, OsExitLineEditMode
+ *
+ * PARAMETERS: None
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Enter/Exit the raw character input mode for the terminal.
+ *
+ * Interactive line-editing support for the AML debugger. Used with the
+ * common/acgetline module.
+ *
+ * readline() is not used because of non-portability. It is not available
+ * on all systems, and if it is, often the package must be manually installed.
+ *
+ * Therefore, we use the POSIX tcgetattr/tcsetattr and do the minimal line
+ * editing that we need in AcpiOsGetLine.
+ *
+ * If the POSIX tcgetattr/tcsetattr interfaces are unavailable, these
+ * calls will also work:
+ * For OsEnterLineEditMode: system ("stty cbreak -echo")
+ * For OsExitLineEditMode: system ("stty cooked echo")
+ *
+ *****************************************************************************/
+
+static void
+OsEnterLineEditMode (
+ void)
+{
+ struct termios LocalTermAttributes;
+
+
+ /* Get and keep the original attributes */
+
+ if (tcgetattr (STDIN_FILENO, &OriginalTermAttributes))
+ {
+ fprintf (stderr, "Could not get/set terminal attributes!\n");
+ return;
+ }
+
+ /* Set the new attributes to enable raw character input */
+
+ memcpy (&LocalTermAttributes, &OriginalTermAttributes,
+ sizeof (struct termios));
+
+ LocalTermAttributes.c_lflag &= ~(ICANON | ECHO);
+ LocalTermAttributes.c_cc[VMIN] = 1;
+ LocalTermAttributes.c_cc[VTIME] = 0;
+
+ tcsetattr (STDIN_FILENO, TCSANOW, &LocalTermAttributes);
+}
+
+static void
+OsExitLineEditMode (
+ void)
+{
+ /* Set terminal attributes back to the original values */
+
+ tcsetattr (STDIN_FILENO, TCSANOW, &OriginalTermAttributes);
+}
+
+
+#else
+
+/* These functions are not needed for other ACPICA utilities */
+
+#define OsEnterLineEditMode()
+#define OsExitLineEditMode()
+#endif
/******************************************************************************
@@ -167,7 +262,7 @@ typedef void* (*PTHREAD_CALLBACK) (void *);
*
* RETURN: Status
*
- * DESCRIPTION: Init and terminate. Nothing to do.
+ * DESCRIPTION: Initialize and terminate this module.
*
*****************************************************************************/
@@ -177,15 +272,17 @@ AcpiOsInitialize (
{
AcpiGbl_OutputFile = stdout;
+
+ OsEnterLineEditMode ();
return (AE_OK);
}
-
ACPI_STATUS
AcpiOsTerminate (
void)
{
+ OsExitLineEditMode ();
return (AE_OK);
}
@@ -442,6 +539,7 @@ AcpiOsVprintf (
}
+#ifndef ACPI_EXEC_APP
/******************************************************************************
*
* FUNCTION: AcpiOsGetLine
@@ -452,7 +550,9 @@ AcpiOsVprintf (
*
* RETURN: Status and actual bytes read
*
- * DESCRIPTION: Formatted input with argument list pointer
+ * DESCRIPTION: Get the next input line from the terminal. NOTE: For the
+ * AcpiExec utility, we use the acgetline module instead to
+ * provide line-editing and history support.
*
*****************************************************************************/
@@ -462,42 +562,46 @@ AcpiOsGetLine (
UINT32 BufferLength,
UINT32 *BytesRead)
{
- int Temp;
- UINT32 i;
+ int InputChar;
+ UINT32 EndOfLine;
- for (i = 0; ; i++)
+ /* Standard AcpiOsGetLine for all utilities except AcpiExec */
+
+ for (EndOfLine = 0; ; EndOfLine++)
{
- if (i >= BufferLength)
+ if (EndOfLine >= BufferLength)
{
return (AE_BUFFER_OVERFLOW);
}
- if ((Temp = getchar ()) == EOF)
+ if ((InputChar = getchar ()) == EOF)
{
return (AE_ERROR);
}
- if (!Temp || Temp == '\n')
+ if (!InputChar || InputChar == _ASCII_NEWLINE)
{
break;
}
- Buffer [i] = (char) Temp;
+ Buffer[EndOfLine] = (char) InputChar;
}
/* Null terminate the buffer */
- Buffer [i] = 0;
+ Buffer[EndOfLine] = 0;
/* Return the number of bytes in the string */
if (BytesRead)
{
- *BytesRead = i;
+ *BytesRead = EndOfLine;
}
+
return (AE_OK);
}
+#endif
/******************************************************************************
@@ -1095,6 +1199,7 @@ AcpiOsReadPciConfiguration (
UINT32 Width)
{
+ *Value = 0;
return (AE_OK);
}
diff --git a/src/acpica/source/tools/acpiexec/aehandlers.c b/src/acpica/source/tools/acpiexec/aehandlers.c
index c5024b5..f0cc8ba 100644
--- a/src/acpica/source/tools/acpiexec/aehandlers.c
+++ b/src/acpica/source/tools/acpiexec/aehandlers.c
@@ -198,6 +198,10 @@ static UINT32
AeEventHandler (
void *Context);
+static UINT32
+AeSciHandler (
+ void *Context);
+
static char *TableEvents[] =
{
"LOAD",
@@ -282,6 +286,7 @@ AeCtrlCHandler (
}
}
+ (void) AcpiOsTerminate ();
exit (0);
}
@@ -704,9 +709,9 @@ AeInterfaceHandler (
#if (!ACPI_REDUCED_HARDWARE)
/******************************************************************************
*
- * FUNCTION: AeEventHandler
+ * FUNCTION: AeEventHandler, AeSciHandler
*
- * DESCRIPTION: Handler for Fixed Events
+ * DESCRIPTION: Handler for Fixed Events and SCIs
*
*****************************************************************************/
@@ -716,6 +721,16 @@ AeEventHandler (
{
return (0);
}
+
+static UINT32
+AeSciHandler (
+ void *Context)
+{
+
+ AcpiOsPrintf ("[AcpiExec] Received an SCI at handler\n");
+ return (0);
+}
+
#endif /* !ACPI_REDUCED_HARDWARE */
@@ -738,10 +753,15 @@ AeRegionInit (
void *HandlerContext,
void **RegionContext)
{
- /*
- * Real simple, set the RegionContext to the RegionHandle
- */
- *RegionContext = RegionHandle;
+
+ if (Function == ACPI_REGION_DEACTIVATE)
+ {
+ *RegionContext = NULL;
+ }
+ else
+ {
+ *RegionContext = RegionHandle;
+ }
return (AE_OK);
}
@@ -749,6 +769,51 @@ AeRegionInit (
/*******************************************************************************
*
+ * FUNCTION: AeInstallSciHandler
+ *
+ * PARAMETERS: None
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Install handler for SCIs. Exercise the code by doing an
+ * install/remove/install.
+ *
+ ******************************************************************************/
+
+static ACPI_STATUS
+AeInstallSciHandler (
+ void)
+{
+ ACPI_STATUS Status;
+
+
+ Status = AcpiInstallSciHandler (AeSciHandler, &AeMyContext);
+ if (ACPI_FAILURE (Status))
+ {
+ ACPI_EXCEPTION ((AE_INFO, Status,
+ "Could not install an SCI handler (1)"));
+ }
+
+ Status = AcpiRemoveSciHandler (AeSciHandler);
+ if (ACPI_FAILURE (Status))
+ {
+ ACPI_EXCEPTION ((AE_INFO, Status,
+ "Could not remove an SCI handler"));
+ }
+
+ Status = AcpiInstallSciHandler (AeSciHandler, &AeMyContext);
+ if (ACPI_FAILURE (Status))
+ {
+ ACPI_EXCEPTION ((AE_INFO, Status,
+ "Could not install an SCI handler (2)"));
+ }
+
+ return (Status);
+}
+
+
+/*******************************************************************************
+ *
* FUNCTION: AeInstallDeviceHandlers, AeInstallEcHandler,
* AeInstallPciHandler
*
@@ -757,7 +822,7 @@ AeRegionInit (
* RETURN: Status
*
* DESCRIPTION: Walk entire namespace, install a handler for every EC
- * device found.
+ * and PCI device found.
*
******************************************************************************/
@@ -857,6 +922,11 @@ AeInstallLateHandlers (
#if (!ACPI_REDUCED_HARDWARE)
if (!AcpiGbl_ReducedHardware)
{
+ /* Install a user SCI handler */
+
+ Status = AeInstallSciHandler ();
+ AE_CHECK_OK (AeInstallSciHandler, Status);
+
/* Install some fixed event handlers */
Status = AcpiInstallFixedEventHandler (ACPI_EVENT_GLOBAL, AeEventHandler, NULL);
--
1.8.3.2
More information about the fwts-devel
mailing list