aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJung-uk Kim <jkim@FreeBSD.org>2013-10-17 00:06:42 +0000
committerJung-uk Kim <jkim@FreeBSD.org>2013-10-17 00:06:42 +0000
commita6028f7332dbf61541a4482e402bf346dad53118 (patch)
tree3908357b831dbb78c746f73c443b4d7ba5e966f9
parent59ce063597ddbda74269a45aba8187dece2fe00a (diff)
downloadsrc-a6028f7332dbf61541a4482e402bf346dad53118.tar.gz
src-a6028f7332dbf61541a4482e402bf346dad53118.zip
Notes
-rw-r--r--changes.txt99
-rw-r--r--generate/unix/Makefile.config10
-rw-r--r--generate/unix/acpiexec/Makefile1
-rw-r--r--generate/unix/iasl/Makefile61
-rw-r--r--source/common/acgetline.c440
-rw-r--r--source/common/adfile.c7
-rw-r--r--source/common/dmextern.c47
-rw-r--r--source/compiler/aslcompiler.h5
-rw-r--r--source/compiler/aslerror.c4
-rw-r--r--source/compiler/aslmain.c32
-rw-r--r--source/compiler/asloptions.c18
-rw-r--r--source/compiler/aslstartup.c173
-rw-r--r--source/components/debugger/dbexec.c44
-rw-r--r--source/components/debugger/dbfileio.c2
-rw-r--r--source/components/debugger/dbhistry.c35
-rw-r--r--source/components/debugger/dbinput.c18
-rw-r--r--source/components/debugger/dbnames.c20
-rw-r--r--source/components/debugger/dbxface.c4
-rw-r--r--source/components/events/evgpe.c3
-rw-r--r--source/components/events/evxface.c1
-rw-r--r--source/components/events/evxfevnt.c1
-rw-r--r--source/components/events/evxfgpe.c1
-rw-r--r--source/components/events/evxfregn.c1
-rw-r--r--source/components/executer/exstore.c168
-rw-r--r--source/components/hardware/hwtimer.c2
-rw-r--r--source/components/hardware/hwxface.c10
-rw-r--r--source/components/hardware/hwxfsleep.c2
-rw-r--r--source/components/namespace/nsdump.c7
-rw-r--r--source/components/namespace/nsxfeval.c9
-rw-r--r--source/components/namespace/nsxfname.c1
-rw-r--r--source/components/namespace/nsxfobj.c1
-rw-r--r--source/components/resources/rsxface.c1
-rw-r--r--source/components/tables/tbprint.c6
-rw-r--r--source/components/tables/tbxface.c5
-rw-r--r--source/components/tables/tbxfload.c3
-rw-r--r--source/components/utilities/utalloc.c131
-rw-r--r--source/components/utilities/utdebug.c1
-rw-r--r--source/components/utilities/utexcep.c1
-rw-r--r--source/components/utilities/utglobal.c1
-rw-r--r--source/components/utilities/utstring.c75
-rw-r--r--source/components/utilities/uttrack.c29
-rw-r--r--source/components/utilities/utxface.c2
-rw-r--r--source/components/utilities/utxferror.c1
-rw-r--r--source/components/utilities/utxfinit.c6
-rw-r--r--source/include/acconfig.h2
-rw-r--r--source/include/acdebug.h4
-rw-r--r--source/include/aclocal.h3
-rw-r--r--source/include/acmacros.h26
-rw-r--r--source/include/acnames.h25
-rw-r--r--source/include/acpiosxf.h118
-rw-r--r--source/include/acpixf.h43
-rw-r--r--source/include/actypes.h42
-rw-r--r--source/include/acutils.h35
-rw-r--r--source/include/platform/acgcc.h2
-rw-r--r--source/include/platform/aclinux.h113
-rw-r--r--source/os_specific/service_layers/osunixxf.c130
-rw-r--r--source/os_specific/service_layers/oswintbl.c7
-rw-r--r--source/os_specific/service_layers/oswinxf.c2
-rw-r--r--source/tools/acpidump/apdump.c2
-rw-r--r--source/tools/acpiexec/aehandlers.c1
-rw-r--r--source/tools/acpiexec/aemain.c441
-rw-r--r--source/tools/acpiexec/aetables.c24
-rw-r--r--source/tools/acpiexec/aetables.h80
-rw-r--r--source/tools/acpisrc/acpisrc.h9
-rw-r--r--source/tools/acpisrc/ascase.c9
-rw-r--r--source/tools/acpisrc/asconvrt.c9
-rw-r--r--source/tools/acpisrc/asfile.c11
-rw-r--r--source/tools/acpisrc/asmain.c14
-rw-r--r--source/tools/acpisrc/asremove.c78
-rw-r--r--source/tools/acpisrc/astable.c89
-rw-r--r--source/tools/acpixtract/acpixtract.c60
71 files changed, 1944 insertions, 924 deletions
diff --git a/changes.txt b/changes.txt
index ab43358d46f5..a0a5931dfafd 100644
--- a/changes.txt
+++ b/changes.txt
@@ -1,4 +1,103 @@
----------------------------------------
+27 September 2013. Summary of changes for version 20130927:
+
+This release is available at https://acpica.org/downloads
+
+
+1) ACPICA kernel-resident subsystem:
+
+Fixed a problem with store operations to reference objects. This change
+fixes a problem where a Store operation to an ArgX object that contained a
+reference to a field object did not complete the automatic dereference and
+then write to the actual field object. Instead, the object type of the
+field object was inadvertently changed to match the type of the source
+operand. The new behavior will actually write to the field object (buffer
+field or field unit), thus matching the correct ACPI-defined behavior.
+
+Implemented support to allow the host to redefine individual OSL
+prototypes. This change enables the host to redefine OSL prototypes found
+in the acpiosxf.h file. This allows the host to implement OSL interfaces
+with a macro or inlined function. Further, it allows the host to add any
+additional required modifiers such as __iomem, __init, __exit, etc., as
+necessary on a per-interface basis. Enables maximum flexibility for the
+OSL interfaces. Lv Zheng.
+
+Hardcoded the access width for the FADT-defined reset register. The ACPI
+specification requires the reset register width to be 8 bits. ACPICA now
+hardcodes the width to 8 and ignores the FADT width value. This provides
+compatibility with other ACPI implementations that have allowed BIOS code
+with bad register width values to go unnoticed. Matthew Garett, Bob Moore,
+Lv Zheng.
+
+Changed the position/use of the ACPI_PRINTF_LIKE macro. This macro is used
+in the OSL header (acpiosxf). The change modifies the position of this
+macro in each instance where it is used (AcpiDebugPrint, etc.) to avoid
+build issues if the OSL defines the implementation of the interface to be
+an inline stub function. Lv Zheng.
+
+Deployed a new macro ACPI_EXPORT_SYMBOL_INIT for the main ACPICA
+initialization interfaces. This change adds a new macro for the main init
+and terminate external interfaces in order to support hosts that require
+additional or different processing for these functions. Changed from
+ACPI_EXPORT_SYMBOL to ACPI_EXPORT_SYMBOL_INIT for these functions. Lv
+Zheng, Bob Moore.
+
+Cleaned up the memory allocation macros for configurability. In the common
+case, the ACPI_ALLOCATE and related macros now resolve directly to their
+respective AcpiOs* OSL interfaces. Two options:
+1) The ACPI_ALLOCATE_ZEROED macro uses a simple local implementation by
+default, unless overridden by the USE_NATIVE_ALLOCATE_ZEROED define.
+2) For AcpiExec (and for debugging), the macros can optionally be resolved
+to the local ACPICA interfaces that track each allocation (local tracking
+is used to immediately detect memory leaks).
+Lv Zheng.
+
+Simplified the configuration for ACPI_REDUCED_HARDWARE. Allows the kernel
+to predefine this macro to either TRUE or FALSE during the system build.
+
+Replaced __FUNCTION_ with __func__ in the gcc-specific header.
+
+Example Code and Data Size: These are the sizes for the OS-independent
+acpica.lib produced by the Microsoft Visual C++ 9.0 32-bit compiler. The
+debug version of the code includes the debug output trace mechanism and
+has a much larger code and data size.
+
+ Current Release:
+ Non-Debug Version: 95.8K Code, 27.0K Data, 122.8K Total
+ Debug Version: 185.2K Code, 77.2K Data, 262.4K Total
+ Previous Release:
+ Non-Debug Version: 96.7K Code, 27.1K Data, 123.9K Total
+ Debug Version: 184.4K Code, 76.8K Data, 261.2K Total
+
+
+2) iASL Compiler/Disassembler and Tools:
+
+iASL: Implemented wildcard support for the -e option. This simplifies use
+when there are many SSDTs that must be included to resolve external method
+declarations. ACPICA BZ 1041. Example:
+ iasl -e ssdt*.dat -d dsdt.dat
+
+AcpiExec: Add history/line-editing for Unix/Linux systems. This change
+adds a portable module that implements full history and limited line
+editing for Unix and Linux systems. It does not use readline() due to
+portability issues. Instead it uses the POSIX termio interface to put the
+terminal in raw input mode so that the various special keys can be trapped
+(such as up/down-arrow for history support and left/right-arrow for line
+editing). Uses the existing debugger history mechanism. ACPICA BZ 1036.
+
+AcpiXtract: Add support to handle (ignore) "empty" lines containing only
+one or more spaces. This provides compatible with early or different
+versions of the AcpiDump utility. ACPICA BZ 1044.
+
+AcpiDump: Do not ignore tables that contain only an ACPI table header.
+Apparently, some BIOSs create SSDTs that contain an ACPI table header but
+no other data. This change adds support to dump these tables. Any tables
+shorter than the length of an ACPI table header remain in error (an error
+message is emitted). Reported by Yi Li.
+
+Debugger: Echo actual command along with the "unknown command" message.
+
+----------------------------------------
23 August 2013. Summary of changes for version 20130823:
1) ACPICA kernel-resident subsystem:
diff --git a/generate/unix/Makefile.config b/generate/unix/Makefile.config
index 3c13f36a5f50..dc9fcaea91d6 100644
--- a/generate/unix/Makefile.config
+++ b/generate/unix/Makefile.config
@@ -193,20 +193,22 @@ endif
#
# Bison/Flex configuration
#
-# -v: verbose, produces a .output file
-# -d: produces the defines header file
# -y: act like yacc
#
# -i: generate case insensitive scanner
# -s: suppress default rule, abort on unknown input
#
+# Optional for Bison/yacc:
+# -v: verbose, produces a .output file
+# -d: produces the defines header file
+#
# Berkeley yacc configuration
#
#YACC= byacc
-#YFLAGS += -v -d
+#YFLAGS +=
#
YACC= bison
-YFLAGS += -v -d -y
+YFLAGS += -y
LEX= flex
LFLAGS += -i -s
diff --git a/generate/unix/acpiexec/Makefile b/generate/unix/acpiexec/Makefile
index 706ec41608d4..278287b286a1 100644
--- a/generate/unix/acpiexec/Makefile
+++ b/generate/unix/acpiexec/Makefile
@@ -39,6 +39,7 @@ HEADERS = \
$(wildcard $(ACPIEXEC)/*.h)
OBJECTS = \
+ $(OBJDIR)/acgetline.o\
$(OBJDIR)/aeexec.o\
$(OBJDIR)/aehandlers.o\
$(OBJDIR)/aemain.o\
diff --git a/generate/unix/iasl/Makefile b/generate/unix/iasl/Makefile
index e9520edf4e31..fd58de9eb7e8 100644
--- a/generate/unix/iasl/Makefile
+++ b/generate/unix/iasl/Makefile
@@ -210,15 +210,9 @@ INTERMEDIATES = \
$(OBJDIR)/prparserparse.c
MISC = \
- $(OBJDIR)/aslcompilerparse.h\
$(OBJDIR)/aslcompiler.y.h\
- $(OBJDIR)/aslcompilerparse.output\
- $(OBJDIR)/dtparserparse.h\
$(OBJDIR)/dtparser.y.h\
- $(OBJDIR)/dtparserparse.output\
- $(OBJDIR)/prparserparse.h\
- $(OBJDIR)/prparser.y.h\
- $(OBJDIR)/prparserparse.output
+ $(OBJDIR)/prparser.y.h
#
# Flags specific to iASL compiler
@@ -237,39 +231,32 @@ include ../Makefile.rules
#
# Parser and Lexer - intermediate C files
#
-$(OBJDIR)/aslcompilerlex.c : $(ASL_COMPILER)/aslcompiler.l $(ASL_COMPILER)/aslsupport.l
+$(OBJDIR)/aslcompilerlex.c : $(ASL_COMPILER)/aslcompiler.l $(ASL_COMPILER)/aslsupport.l $(OBJDIR)/aslcompiler.y.h
$(LEX) $(LFLAGS) -PAslCompiler -o$@ $(ASL_COMPILER)/aslcompiler.l
-$(OBJDIR)/aslcompilerparse.c $(OBJDIR)/aslcompilerparse.h : $(ASL_COMPILER)/aslcompiler.y
- $(YACC) $(YFLAGS) -pAslCompiler -o$@ $?
+$(OBJDIR)/aslcompiler.y.h : $(ASL_COMPILER)/aslcompiler.y
+ $(YACC) $(YFLAGS) -pAslCompiler -o/dev/null --defines=$@ $<
-$(OBJDIR)/dtparserlex.c : $(ASL_COMPILER)/dtparser.l
- $(LEX) $(LFLAGS) -PDtParser -o$@ $?
+$(OBJDIR)/aslcompilerparse.c : $(ASL_COMPILER)/aslcompiler.y
+ $(YACC) $(YFLAGS) -pAslCompiler -o$@ --defines=/dev/null $<
-$(OBJDIR)/dtparserparse.c $(OBJDIR)/dtparserparse.h : $(ASL_COMPILER)/dtparser.y
- $(YACC) $(YFLAGS) -pDtParser -o$@ $?
+$(OBJDIR)/dtparserlex.c : $(ASL_COMPILER)/dtparser.l $(OBJDIR)/dtparser.y.h
+ $(LEX) $(LFLAGS) -PDtParser -o$@ $<
-$(OBJDIR)/prparserlex.c : $(ASL_COMPILER)/prparser.l
- $(LEX) $(LFLAGS) -PPrParser -o$@ $?
+$(OBJDIR)/dtparser.y.h : $(ASL_COMPILER)/dtparser.y
+ $(YACC) $(YFLAGS) -pDtParser -o/dev/null --defines=$@ $<
-$(OBJDIR)/prparserparse.c $(OBJDIR)/prparserparse.h : $(ASL_COMPILER)/prparser.y
- $(YACC) $(YFLAGS) -pPrParser -o$@ $?
+$(OBJDIR)/dtparserparse.c : $(ASL_COMPILER)/dtparser.y
+ $(YACC) $(YFLAGS) -pDtParser -o$@ --defines=/dev/null $<
+$(OBJDIR)/prparserlex.c : $(ASL_COMPILER)/prparser.l $(OBJDIR)/prparser.y.h
+ $(LEX) $(LFLAGS) -PPrParser -o$@ $<
-#
-# Rename the headers produced by bison/yacc
-#
-$(OBJDIR)/aslcompiler.y.h : $(OBJDIR)/aslcompilerparse.h
- @echo Copy intermediate file:
- @cp -f -v $(OBJDIR)/aslcompilerparse.h $(OBJDIR)/aslcompiler.y.h
-
-$(OBJDIR)/dtparser.y.h: $(OBJDIR)/dtparserparse.h
- @echo Copy intermediate file:
- @cp -f -v $(OBJDIR)/dtparserparse.h $(OBJDIR)/dtparser.y.h
+$(OBJDIR)/prparser.y.h : $(ASL_COMPILER)/prparser.y
+ $(YACC) $(YFLAGS) -pPrParser -o/dev/null --defines=$@ $<
-$(OBJDIR)/prparser.y.h: $(OBJDIR)/prparserparse.h
- @echo Copy intermediate file:
- @cp -f -v $(OBJDIR)/prparserparse.h $(OBJDIR)/prparser.y.h
+$(OBJDIR)/prparserparse.c : $(ASL_COMPILER)/prparser.y
+ $(YACC) $(YFLAGS) -pPrParser -o$@ --defines=/dev/null $<
#
@@ -279,19 +266,19 @@ $(OBJDIR)/prparser.y.h: $(OBJDIR)/prparserparse.h
# by the utilities above and they are not necessarily ANSI C, etc.
#
$(OBJDIR)/aslcompilerlex.o : $(OBJDIR)/aslcompilerlex.c
- $(CC) -c $(CFLAGS) -Wall -Werror -o$@ $?
+ $(CC) -c $(CFLAGS) -Wall -Werror -o$@ $<
$(OBJDIR)/aslcompilerparse.o : $(OBJDIR)/aslcompilerparse.c
- $(CC) -c $(CFLAGS) -Wall -Werror -o$@ $?
+ $(CC) -c $(CFLAGS) -Wall -Werror -o$@ $<
$(OBJDIR)/dtparserlex.o : $(OBJDIR)/dtparserlex.c
- $(CC) -c $(CFLAGS) -Wall -Werror -o$@ $?
+ $(CC) -c $(CFLAGS) -Wall -Werror -o$@ $<
$(OBJDIR)/dtparserparse.o : $(OBJDIR)/dtparserparse.c
- $(CC) -c $(CFLAGS) -Wall -Werror -o$@ $?
+ $(CC) -c $(CFLAGS) -Wall -Werror -o$@ $<
$(OBJDIR)/prparserlex.o : $(OBJDIR)/prparserlex.c
- $(CC) -c $(CFLAGS) -Wall -Werror -o$@ $?
+ $(CC) -c $(CFLAGS) -Wall -Werror -o$@ $<
$(OBJDIR)/prparserparse.o : $(OBJDIR)/prparserparse.c
- $(CC) -c $(CFLAGS) -Wall -Werror -o$@ $?
+ $(CC) -c $(CFLAGS) -Wall -Werror -o$@ $<
diff --git a/source/common/acgetline.c b/source/common/acgetline.c
new file mode 100644
index 000000000000..ca9d7c309d4b
--- /dev/null
+++ b/source/common/acgetline.c
@@ -0,0 +1,440 @@
+/******************************************************************************
+ *
+ * Module Name: acgetline - local line editing
+ *
+ *****************************************************************************/
+
+/*
+ * Copyright (C) 2000 - 2013, Intel Corp.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions, and the following disclaimer,
+ * without modification.
+ * 2. Redistributions in binary form must reproduce at minimum a disclaimer
+ * substantially similar to the "NO WARRANTY" disclaimer below
+ * ("Disclaimer") and any redistribution must be conditioned upon
+ * including a substantially similar Disclaimer requirement for further
+ * binary redistribution.
+ * 3. Neither the names of the above-listed copyright holders nor the names
+ * of any contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * Alternatively, this software may be distributed under the terms of the
+ * GNU General Public License ("GPL") version 2 as published by the Free
+ * Software Foundation.
+ *
+ * NO WARRANTY
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGES.
+ */
+
+#include "acpi.h"
+#include "accommon.h"
+#include "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/source/common/adfile.c b/source/common/adfile.c
index dc1f0a2f385c..48ff89fc841e 100644
--- a/source/common/adfile.c
+++ b/source/common/adfile.c
@@ -288,7 +288,6 @@ FlSplitInputPathname (
*OutDirectoryPath = NULL;
- *OutFilename = NULL;
if (!InputPath)
{
@@ -334,6 +333,10 @@ FlSplitInputPathname (
}
*OutDirectoryPath = DirectoryPath;
- *OutFilename = Filename;
+
+ if (OutFilename)
+ {
+ *OutFilename = Filename;
+ }
return (AE_OK);
}
diff --git a/source/common/dmextern.c b/source/common/dmextern.c
index b78304067f19..002d08860af6 100644
--- a/source/common/dmextern.c
+++ b/source/common/dmextern.c
@@ -279,48 +279,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);
}
diff --git a/source/compiler/aslcompiler.h b/source/compiler/aslcompiler.h
index 1ffbf924ea76..b8648a628fa5 100644
--- a/source/compiler/aslcompiler.h
+++ b/source/compiler/aslcompiler.h
@@ -123,11 +123,6 @@ ACPI_STATUS (*ASL_PATHNAME_CALLBACK) (
char *);
ACPI_STATUS
-AslDoOnePathname (
- char *Pathname,
- ASL_PATHNAME_CALLBACK Callback);
-
-ACPI_STATUS
AslDoOneFile (
char *Filename);
diff --git a/source/compiler/aslerror.c b/source/compiler/aslerror.c
index 06160401303c..d0e8e03bc060 100644
--- a/source/compiler/aslerror.c
+++ b/source/compiler/aslerror.c
@@ -611,7 +611,6 @@ AslCommonError (
char *Filename,
char *ExtraMessage)
{
- UINT32 MessageSize;
char *MessageBuffer = NULL;
ASL_ERROR_MSG *Enode;
@@ -622,8 +621,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/source/compiler/aslmain.c b/source/compiler/aslmain.c
index 2e62c8705a84..81e102f303e2 100644
--- a/source/compiler/aslmain.c
+++ b/source/compiler/aslmain.c
@@ -51,6 +51,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 */
@@ -131,13 +142,13 @@ 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");
@@ -321,7 +332,7 @@ main (
{
while (argv[Index1])
{
- Status = AslDoOnePathname (argv[Index1], AcpiDmAddToExternalFileList);
+ Status = AcpiDmAddToExternalFileList (argv[Index1]);
if (ACPI_FAILURE (Status))
{
return (-1);
@@ -335,7 +346,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/source/compiler/asloptions.c b/source/compiler/asloptions.c
index 5fbd43eeb613..00e30004e921 100644
--- a/source/compiler/asloptions.c
+++ b/source/compiler/asloptions.c
@@ -267,11 +267,21 @@ AslDoOptions (
case 'e': /* External files for disassembler */
- Status = AcpiDmAddToExternalFileList (AcpiGbl_Optarg);
- if (ACPI_FAILURE (Status))
+ /* Get entire list of external files */
+
+ AcpiGbl_Optind--;
+
+ while (argv[AcpiGbl_Optind] &&
+ (argv[AcpiGbl_Optind][0] != '-'))
{
- printf ("Could not add %s to external list\n", AcpiGbl_Optarg);
- return (-1);
+ Status = AcpiDmAddToExternalFileList (argv[AcpiGbl_Optind]);
+ if (ACPI_FAILURE (Status))
+ {
+ printf ("Could not add %s to external list\n", argv[AcpiGbl_Optind]);
+ return (-1);
+ }
+
+ AcpiGbl_Optind++;
}
break;
diff --git a/source/compiler/aslstartup.c b/source/compiler/aslstartup.c
index 0168fd020b47..b57b3b0b95f4 100644
--- a/source/compiler/aslstartup.c
+++ b/source/compiler/aslstartup.c
@@ -51,18 +51,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);
@@ -72,6 +62,11 @@ AslDoDisassembly (
void);
+/* Globals */
+
+static BOOLEAN AslToFile = TRUE;
+
+
/*******************************************************************************
*
* FUNCTION: AslInitializeGlobals
@@ -131,82 +126,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
@@ -395,6 +314,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;
/*
@@ -543,77 +473,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/source/components/debugger/dbexec.c b/source/components/debugger/dbexec.c
index dff3c79ad682..668dcdd332e7 100644
--- a/source/components/debugger/dbexec.c
+++ b/source/components/debugger/dbexec.c
@@ -62,7 +62,7 @@ AcpiDbExecuteMethod (
ACPI_DB_METHOD_INFO *Info,
ACPI_BUFFER *ReturnObj);
-static void
+static ACPI_STATUS
AcpiDbExecuteSetup (
ACPI_DB_METHOD_INFO *Info);
@@ -237,10 +237,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 */
@@ -248,10 +253,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);
@@ -269,6 +285,13 @@ AcpiDbExecuteSetup (
AcpiDbSetOutputDestination (ACPI_DB_REDIRECTABLE_OUTPUT);
}
+
+ return (AE_OK);
+
+ErrorExit:
+
+ ACPI_EXCEPTION ((AE_INFO, Status, "During setup for method execution"));
+ return (Status);
}
@@ -429,7 +452,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 */
@@ -729,7 +757,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/source/components/debugger/dbfileio.c b/source/components/debugger/dbfileio.c
index 3ba9653ddc9a..373e7ad39398 100644
--- a/source/components/debugger/dbfileio.c
+++ b/source/components/debugger/dbfileio.c
@@ -492,7 +492,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/source/components/debugger/dbhistry.c b/source/components/debugger/dbhistry.c
index ff116045d1ee..2daa01ff6492 100644
--- a/source/components/debugger/dbhistry.c
+++ b/source/components/debugger/dbhistry.c
@@ -69,7 +69,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;
/*******************************************************************************
@@ -94,6 +94,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 (
@@ -203,8 +208,6 @@ char *
AcpiDbGetFromHistory (
char *CommandNumArg)
{
- UINT32 i;
- UINT16 HistoryIndex;
UINT32 CmdNum;
@@ -218,6 +221,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;
@@ -230,6 +258,7 @@ AcpiDbGetFromHistory (
return (AcpiGbl_HistoryBuffer[HistoryIndex].Command);
}
+ /* History buffer is circular */
HistoryIndex++;
if (HistoryIndex >= HISTORY_SIZE)
diff --git a/source/components/debugger/dbinput.c b/source/components/debugger/dbinput.c
index 511e5855d405..147a02380236 100644
--- a/source/components/debugger/dbinput.c
+++ b/source/components/debugger/dbinput.c
@@ -635,7 +635,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++)
@@ -740,6 +746,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;
@@ -1135,7 +1146,7 @@ AcpiDbCommandDispatch (
case CMD_NOT_FOUND:
default:
- AcpiOsPrintf ("Unknown Command\n");
+ AcpiOsPrintf ("%s: unknown command\n", AcpiGbl_DbArgs[0]);
return (AE_CTRL_TRUE);
}
@@ -1144,9 +1155,6 @@ AcpiDbCommandDispatch (
Status = AE_CTRL_TRUE;
}
- /* Add all commands that come here to the history buffer */
-
- AcpiDbAddToHistory (InputBuffer);
return (Status);
}
diff --git a/source/components/debugger/dbnames.c b/source/components/debugger/dbnames.c
index e3c6d710a940..c071289c1be1 100644
--- a/source/components/debugger/dbnames.c
+++ b/source/components/debugger/dbnames.c
@@ -171,8 +171,7 @@ AcpiDbSetScope (
goto ErrorExit;
}
- ACPI_STRCPY (AcpiGbl_DbScopeBuf, Name);
- ACPI_STRCAT (AcpiGbl_DbScopeBuf, "\\");
+ AcpiGbl_DbScopeBuf[0] = 0;
}
else
{
@@ -184,9 +183,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;
diff --git a/source/components/debugger/dbxface.c b/source/components/debugger/dbxface.c
index 3c1df5b71136..eedff1fd26ae 100644
--- a/source/components/debugger/dbxface.c
+++ b/source/components/debugger/dbxface.c
@@ -507,6 +507,10 @@ AcpiDbTerminate (
AcpiOsFree (AcpiGbl_DbBuffer);
AcpiGbl_DbBuffer = NULL;
}
+
+ /* Ensure that debug output is now disabled */
+
+ AcpiGbl_DbOutputFlags = ACPI_DB_DISABLE_OUTPUT;
}
diff --git a/source/components/events/evgpe.c b/source/components/events/evgpe.c
index 9b80f08d214a..08286065b17b 100644
--- a/source/components/events/evgpe.c
+++ b/source/components/events/evgpe.c
@@ -549,6 +549,7 @@ AcpiEvAsynchExecuteGpeMethod (
Status = AcpiUtAcquireMutex (ACPI_MTX_EVENTS);
if (ACPI_FAILURE (Status))
{
+ ACPI_FREE (LocalGpeEventInfo);
return_VOID;
}
@@ -557,6 +558,7 @@ AcpiEvAsynchExecuteGpeMethod (
if (!AcpiEvValidGpeEvent (GpeEventInfo))
{
Status = AcpiUtReleaseMutex (ACPI_MTX_EVENTS);
+ ACPI_FREE (LocalGpeEventInfo);
return_VOID;
}
@@ -570,6 +572,7 @@ AcpiEvAsynchExecuteGpeMethod (
Status = AcpiUtReleaseMutex (ACPI_MTX_EVENTS);
if (ACPI_FAILURE (Status))
{
+ ACPI_FREE (LocalGpeEventInfo);
return_VOID;
}
diff --git a/source/components/events/evxface.c b/source/components/events/evxface.c
index 0e8393097afb..9bce5248b1b1 100644
--- a/source/components/events/evxface.c
+++ b/source/components/events/evxface.c
@@ -43,6 +43,7 @@
#define __EVXFACE_C__
+#define EXPORT_ACPI_INTERFACES
#include "acpi.h"
#include "accommon.h"
diff --git a/source/components/events/evxfevnt.c b/source/components/events/evxfevnt.c
index ae3378e2c00f..ce1ce4d0e9e8 100644
--- a/source/components/events/evxfevnt.c
+++ b/source/components/events/evxfevnt.c
@@ -43,6 +43,7 @@
#define __EVXFEVNT_C__
+#define EXPORT_ACPI_INTERFACES
#include "acpi.h"
#include "accommon.h"
diff --git a/source/components/events/evxfgpe.c b/source/components/events/evxfgpe.c
index 1deff5be88a5..e76b7f1ed336 100644
--- a/source/components/events/evxfgpe.c
+++ b/source/components/events/evxfgpe.c
@@ -43,6 +43,7 @@
#define __EVXFGPE_C__
+#define EXPORT_ACPI_INTERFACES
#include "acpi.h"
#include "accommon.h"
diff --git a/source/components/events/evxfregn.c b/source/components/events/evxfregn.c
index 4b5b3d03ffe4..5879da68b9b2 100644
--- a/source/components/events/evxfregn.c
+++ b/source/components/events/evxfregn.c
@@ -43,6 +43,7 @@
*/
#define __EVXFREGN_C__
+#define EXPORT_ACPI_INTERFACES
#include "acpi.h"
#include "accommon.h"
diff --git a/source/components/executer/exstore.c b/source/components/executer/exstore.c
index 2ec392e90e60..f54428b0e897 100644
--- a/source/components/executer/exstore.c
+++ b/source/components/executer/exstore.c
@@ -62,6 +62,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);
+
/*******************************************************************************
*
@@ -393,7 +399,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.
*
@@ -420,7 +430,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)));
@@ -434,49 +444,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);
@@ -489,11 +485,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",
@@ -502,33 +499,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/source/components/hardware/hwtimer.c b/source/components/hardware/hwtimer.c
index cbfa96b0c7a3..c42576edca1a 100644
--- a/source/components/hardware/hwtimer.c
+++ b/source/components/hardware/hwtimer.c
@@ -41,6 +41,8 @@
* POSSIBILITY OF SUCH DAMAGES.
*/
+#define EXPORT_ACPI_INTERFACES
+
#include "acpi.h"
#include "accommon.h"
diff --git a/source/components/hardware/hwxface.c b/source/components/hardware/hwxface.c
index 45d56540fb96..a1d5a04bb5dd 100644
--- a/source/components/hardware/hwxface.c
+++ b/source/components/hardware/hwxface.c
@@ -41,6 +41,8 @@
* POSSIBILITY OF SUCH DAMAGES.
*/
+#define EXPORT_ACPI_INTERFACES
+
#include "acpi.h"
#include "accommon.h"
#include "acnamesp.h"
@@ -90,9 +92,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
{
diff --git a/source/components/hardware/hwxfsleep.c b/source/components/hardware/hwxfsleep.c
index 8259f012e842..9131f95181bb 100644
--- a/source/components/hardware/hwxfsleep.c
+++ b/source/components/hardware/hwxfsleep.c
@@ -41,6 +41,8 @@
* POSSIBILITY OF SUCH DAMAGES.
*/
+#define EXPORT_ACPI_INTERFACES
+
#include "acpi.h"
#include "accommon.h"
diff --git a/source/components/namespace/nsdump.c b/source/components/namespace/nsdump.c
index 5559d9a9e41a..4f6a7f99467f 100644
--- a/source/components/namespace/nsdump.c
+++ b/source/components/namespace/nsdump.c
@@ -748,6 +748,13 @@ AcpiNsDumpOneObjectPath (
}
Node = AcpiNsValidateHandle (ObjHandle);
+ if (!Node)
+ {
+ /* Ignore bad node during namespace walk */
+
+ return (AE_OK);
+ }
+
Pathname = AcpiNsGetExternalPathname (Node);
PathIndent = 1;
diff --git a/source/components/namespace/nsxfeval.c b/source/components/namespace/nsxfeval.c
index 007ade31bd8a..a1af583a6001 100644
--- a/source/components/namespace/nsxfeval.c
+++ b/source/components/namespace/nsxfeval.c
@@ -44,6 +44,7 @@
#define __NSXFEVAL_C__
+#define EXPORT_ACPI_INTERFACES
#include "acpi.h"
#include "accommon.h"
@@ -148,8 +149,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;
}
diff --git a/source/components/namespace/nsxfname.c b/source/components/namespace/nsxfname.c
index 289ecd812f54..5ef49c4dd492 100644
--- a/source/components/namespace/nsxfname.c
+++ b/source/components/namespace/nsxfname.c
@@ -43,6 +43,7 @@
*/
#define __NSXFNAME_C__
+#define EXPORT_ACPI_INTERFACES
#include "acpi.h"
#include "accommon.h"
diff --git a/source/components/namespace/nsxfobj.c b/source/components/namespace/nsxfobj.c
index 96c5111f3355..d3adfdb242b2 100644
--- a/source/components/namespace/nsxfobj.c
+++ b/source/components/namespace/nsxfobj.c
@@ -44,6 +44,7 @@
#define __NSXFOBJ_C__
+#define EXPORT_ACPI_INTERFACES
#include "acpi.h"
#include "accommon.h"
diff --git a/source/components/resources/rsxface.c b/source/components/resources/rsxface.c
index 0523f5b07bdf..67049e043275 100644
--- a/source/components/resources/rsxface.c
+++ b/source/components/resources/rsxface.c
@@ -43,6 +43,7 @@
#define __RSXFACE_C__
+#define EXPORT_ACPI_INTERFACES
#include "acpi.h"
#include "accommon.h"
diff --git a/source/components/tables/tbprint.c b/source/components/tables/tbprint.c
index f24de49a339e..719ade6e262d 100644
--- a/source/components/tables/tbprint.c
+++ b/source/components/tables/tbprint.c
@@ -154,7 +154,7 @@ 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));
}
@@ -166,7 +166,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,
@@ -180,7 +180,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,
diff --git a/source/components/tables/tbxface.c b/source/components/tables/tbxface.c
index 53081625999b..16449269eebb 100644
--- a/source/components/tables/tbxface.c
+++ b/source/components/tables/tbxface.c
@@ -42,6 +42,7 @@
*/
#define __TBXFACE_C__
+#define EXPORT_ACPI_INTERFACES
#include "acpi.h"
#include "accommon.h"
@@ -161,7 +162,7 @@ AcpiInitializeTables (
return_ACPI_STATUS (Status);
}
-ACPI_EXPORT_SYMBOL (AcpiInitializeTables)
+ACPI_EXPORT_SYMBOL_INIT (AcpiInitializeTables)
/*******************************************************************************
@@ -204,7 +205,7 @@ AcpiReallocateRootTable (
return_ACPI_STATUS (Status);
}
-ACPI_EXPORT_SYMBOL (AcpiReallocateRootTable)
+ACPI_EXPORT_SYMBOL_INIT (AcpiReallocateRootTable)
/*******************************************************************************
diff --git a/source/components/tables/tbxfload.c b/source/components/tables/tbxfload.c
index 2ebaab97716e..6b2d5fa744a2 100644
--- a/source/components/tables/tbxfload.c
+++ b/source/components/tables/tbxfload.c
@@ -42,6 +42,7 @@
*/
#define __TBXFLOAD_C__
+#define EXPORT_ACPI_INTERFACES
#include "acpi.h"
#include "accommon.h"
@@ -92,7 +93,7 @@ AcpiLoadTables (
return_ACPI_STATUS (Status);
}
-ACPI_EXPORT_SYMBOL (AcpiLoadTables)
+ACPI_EXPORT_SYMBOL_INIT (AcpiLoadTables)
/*******************************************************************************
diff --git a/source/components/utilities/utalloc.c b/source/components/utilities/utalloc.c
index 2169fe894f04..51eee9719d66 100644
--- a/source/components/utilities/utalloc.c
+++ b/source/components/utilities/utalloc.c
@@ -51,6 +51,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
@@ -321,95 +360,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/source/components/utilities/utdebug.c b/source/components/utilities/utdebug.c
index 712c188dc7e7..ab162360adf7 100644
--- a/source/components/utilities/utdebug.c
+++ b/source/components/utilities/utdebug.c
@@ -42,6 +42,7 @@
*/
#define __UTDEBUG_C__
+#define EXPORT_ACPI_INTERFACES
#include "acpi.h"
#include "accommon.h"
diff --git a/source/components/utilities/utexcep.c b/source/components/utilities/utexcep.c
index 75258d905eae..2c353861a243 100644
--- a/source/components/utilities/utexcep.c
+++ b/source/components/utilities/utexcep.c
@@ -43,6 +43,7 @@
#define __UTEXCEP_C__
+#define EXPORT_ACPI_INTERFACES
#define ACPI_DEFINE_EXCEPTION_TABLE
#include "acpi.h"
diff --git a/source/components/utilities/utglobal.c b/source/components/utilities/utglobal.c
index ff245159417a..70ad3f4d0cd3 100644
--- a/source/components/utilities/utglobal.c
+++ b/source/components/utilities/utglobal.c
@@ -42,6 +42,7 @@
*/
#define __UTGLOBAL_C__
+#define EXPORT_ACPI_INTERFACES
#define DEFINE_ACPI_GLOBALS
#include "acpi.h"
diff --git a/source/components/utilities/utstring.c b/source/components/utilities/utstring.c
index 97987003fe8c..282869c5416d 100644
--- a/source/components/utilities/utstring.c
+++ b/source/components/utilities/utstring.c
@@ -685,3 +685,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/source/components/utilities/uttrack.c b/source/components/utilities/uttrack.c
index 6cf9bdf45d63..70d458515fa7 100644
--- a/source/components/utilities/uttrack.c
+++ b/source/components/utilities/uttrack.c
@@ -151,10 +151,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);
}
@@ -204,8 +217,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/source/components/utilities/utxface.c b/source/components/utilities/utxface.c
index 021a4627702c..3087d671bf67 100644
--- a/source/components/utilities/utxface.c
+++ b/source/components/utilities/utxface.c
@@ -114,7 +114,7 @@ AcpiTerminate (
return_ACPI_STATUS (Status);
}
-ACPI_EXPORT_SYMBOL (AcpiTerminate)
+ACPI_EXPORT_SYMBOL_INIT (AcpiTerminate)
#ifndef ACPI_ASL_COMPILER
diff --git a/source/components/utilities/utxferror.c b/source/components/utilities/utxferror.c
index a01b5b076f9d..366eae1d7a3a 100644
--- a/source/components/utilities/utxferror.c
+++ b/source/components/utilities/utxferror.c
@@ -42,6 +42,7 @@
*/
#define __UTXFERROR_C__
+#define EXPORT_ACPI_INTERFACES
#include "acpi.h"
#include "accommon.h"
diff --git a/source/components/utilities/utxfinit.c b/source/components/utilities/utxfinit.c
index 53126819e733..a9d9251ae9b6 100644
--- a/source/components/utilities/utxfinit.c
+++ b/source/components/utilities/utxfinit.c
@@ -134,7 +134,7 @@ AcpiInitializeSubsystem (
return_ACPI_STATUS (Status);
}
-ACPI_EXPORT_SYMBOL (AcpiInitializeSubsystem)
+ACPI_EXPORT_SYMBOL_INIT (AcpiInitializeSubsystem)
/*******************************************************************************
@@ -256,7 +256,7 @@ AcpiEnableSubsystem (
return_ACPI_STATUS (Status);
}
-ACPI_EXPORT_SYMBOL (AcpiEnableSubsystem)
+ACPI_EXPORT_SYMBOL_INIT (AcpiEnableSubsystem)
/*******************************************************************************
@@ -355,4 +355,4 @@ AcpiInitializeObjects (
return_ACPI_STATUS (Status);
}
-ACPI_EXPORT_SYMBOL (AcpiInitializeObjects)
+ACPI_EXPORT_SYMBOL_INIT (AcpiInitializeObjects)
diff --git a/source/include/acconfig.h b/source/include/acconfig.h
index 6a267fecf413..48f220b51391 100644
--- a/source/include/acconfig.h
+++ b/source/include/acconfig.h
@@ -101,7 +101,9 @@
* ACPI PM timer
* FACS table (Waking vectors and Global Lock)
*/
+#ifndef ACPI_REDUCED_HARDWARE
#define ACPI_REDUCED_HARDWARE FALSE
+#endif
/******************************************************************************
diff --git a/source/include/acdebug.h b/source/include/acdebug.h
index 37d41d32190f..b8ae659a3a5e 100644
--- a/source/include/acdebug.h
+++ b/source/include/acdebug.h
@@ -393,6 +393,10 @@ char *
AcpiDbGetFromHistory (
char *CommandNumArg);
+char *
+AcpiDbGetHistoryByIndex (
+ UINT32 CommanddNum);
+
/*
* dbinput - user front-end to the AML debugger
diff --git a/source/include/aclocal.h b/source/include/aclocal.h
index 5ee1430132c5..0febef451cdc 100644
--- a/source/include/aclocal.h
+++ b/source/include/aclocal.h
@@ -1259,7 +1259,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;
@@ -1286,6 +1286,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/source/include/acmacros.h b/source/include/acmacros.h
index 28bd2afea2db..5489db33b3db 100644
--- a/source/include/acmacros.h
+++ b/source/include/acmacros.h
@@ -415,32 +415,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/source/include/acnames.h b/source/include/acnames.h
index d6fdaa6f5774..cd8fb93b5632 100644
--- a/source/include/acnames.h
+++ b/source/include/acnames.h
@@ -46,24 +46,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/source/include/acpiosxf.h b/source/include/acpiosxf.h
index f3f624d36971..4c4f2268af6f 100644
--- a/source/include/acpiosxf.h
+++ b/source/include/acpiosxf.h
@@ -6,7 +6,6 @@
*
*****************************************************************************/
-
/*
* Copyright (C) 2000 - 2013, Intel Corp.
* All rights reserved.
@@ -85,85 +84,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
/*
@@ -172,151 +197,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
/*
@@ -324,103 +406,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 */
@@ -428,13 +538,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/source/include/acpixf.h b/source/include/acpixf.h
index 18e520027543..cba3e569f4a8 100644
--- a/source/include/acpixf.h
+++ b/source/include/acpixf.h
@@ -47,7 +47,7 @@
/* Current ACPICA subsystem version in YYYYMMDD format */
-#define ACPI_CA_VERSION 0x20130823
+#define ACPI_CA_VERSION 0x20130927
#include "acconfig.h"
#include "actypes.h"
@@ -106,7 +106,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 */
@@ -195,21 +195,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
@@ -766,48 +751,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);
+ ...);
/*
@@ -815,6 +806,7 @@ AcpiBiosWarning (
*/
#ifdef ACPI_DEBUG_OUTPUT
+ACPI_PRINTF_LIKE(6)
void ACPI_INTERNAL_VAR_XFACE
AcpiDebugPrint (
UINT32 RequestedDebugLevel,
@@ -823,8 +815,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,
@@ -833,7 +826,7 @@ AcpiDebugPrintRaw (
const char *ModuleName,
UINT32 ComponentId,
const char *Format,
- ...) ACPI_PRINTF_LIKE(6);
+ ...);
#endif
#endif /* __ACXFACE_H__ */
diff --git a/source/include/actypes.h b/source/include/actypes.h
index dafbfd53a62b..7c484b21d49e 100644
--- a/source/include/actypes.h
+++ b/source/include/actypes.h
@@ -303,9 +303,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
@@ -319,6 +328,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)
@@ -335,6 +372,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 */
diff --git a/source/include/acutils.h b/source/include/acutils.h
index c80dd36ca4f6..de62498635d4 100644
--- a/source/include/acutils.h
+++ b/source/include/acutils.h
@@ -926,6 +926,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
@@ -967,20 +988,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/source/include/platform/acgcc.h b/source/include/platform/acgcc.h
index 1662a9bb81c7..a091cc0e7630 100644
--- a/source/include/platform/acgcc.h
+++ b/source/include/platform/acgcc.h
@@ -48,7 +48,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/source/include/platform/aclinux.h b/source/include/platform/aclinux.h
index edd45567e0f6..b6a7e1791f38 100644
--- a/source/include/platform/aclinux.h
+++ b/source/include/platform/aclinux.h
@@ -111,13 +111,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.
@@ -125,25 +134,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
/*
@@ -164,16 +197,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/source/os_specific/service_layers/osunixxf.c b/source/os_specific/service_layers/osunixxf.c
index fab1cd12776c..fee51a610726 100644
--- a/source/os_specific/service_layers/osunixxf.c
+++ b/source/os_specific/service_layers/osunixxf.c
@@ -67,6 +67,7 @@
extern FILE *AcpiGbl_DebugFile;
FILE *AcpiGbl_OutputFile;
+BOOLEAN AcpiGbl_DebugTimeout = FALSE;
/* Upcalls to AcpiExec */
@@ -84,7 +85,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
/******************************************************************************
@@ -95,7 +190,7 @@ typedef void* (*PTHREAD_CALLBACK) (void *);
*
* RETURN: Status
*
- * DESCRIPTION: Init and terminate. Nothing to do.
+ * DESCRIPTION: Initialize and terminate this module.
*
*****************************************************************************/
@@ -105,15 +200,17 @@ AcpiOsInitialize (
{
AcpiGbl_OutputFile = stdout;
+
+ OsEnterLineEditMode ();
return (AE_OK);
}
-
ACPI_STATUS
AcpiOsTerminate (
void)
{
+ OsExitLineEditMode ();
return (AE_OK);
}
@@ -370,6 +467,7 @@ AcpiOsVprintf (
}
+#ifndef ACPI_EXEC_APP
/******************************************************************************
*
* FUNCTION: AcpiOsGetLine
@@ -380,7 +478,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.
*
*****************************************************************************/
@@ -390,42 +490,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
/******************************************************************************
diff --git a/source/os_specific/service_layers/oswintbl.c b/source/os_specific/service_layers/oswintbl.c
index c03851d65443..884fd37f68e5 100644
--- a/source/os_specific/service_layers/oswintbl.c
+++ b/source/os_specific/service_layers/oswintbl.c
@@ -42,6 +42,8 @@
*/
#include "acpi.h"
+#include "accommon.h"
+#include "acutils.h"
#include <stdio.h>
#ifdef WIN32
@@ -236,7 +238,10 @@ AcpiOsGetTableByName (
while (1)
{
ACPI_STRCPY (KeyBuffer, "HARDWARE\\ACPI\\");
- ACPI_STRCAT (KeyBuffer, Signature);
+ if (AcpiUtSafeStrcat (KeyBuffer, sizeof (KeyBuffer), Signature))
+ {
+ return (AE_BUFFER_OVERFLOW);
+ }
WinStatus = RegOpenKeyEx (HKEY_LOCAL_MACHINE, KeyBuffer,
0L, KEY_READ, &Handle);
diff --git a/source/os_specific/service_layers/oswinxf.c b/source/os_specific/service_layers/oswinxf.c
index b946f32b3b74..697fd45082c5 100644
--- a/source/os_specific/service_layers/oswinxf.c
+++ b/source/os_specific/service_layers/oswinxf.c
@@ -65,7 +65,6 @@
extern FILE *AcpiGbl_DebugFile;
-extern BOOLEAN AcpiGbl_DebugTimeout;
FILE *AcpiGbl_OutputFile;
UINT64 TimerFrequency;
@@ -108,6 +107,7 @@ ACPI_OS_SEMAPHORE_INFO AcpiGbl_Semaphores[ACPI_OS_MAX_SEMAPHORES];
#endif /* ACPI_SINGLE_THREADED */
+BOOLEAN AcpiGbl_DebugTimeout = FALSE;
/******************************************************************************
*
diff --git a/source/tools/acpidump/apdump.c b/source/tools/acpidump/apdump.c
index 6317b25d223e..d216cf5e45e5 100644
--- a/source/tools/acpidump/apdump.c
+++ b/source/tools/acpidump/apdump.c
@@ -82,7 +82,7 @@ ApIsValidHeader (
/* Check for minimum table length */
- if (Table->Length <= sizeof (ACPI_TABLE_HEADER))
+ if (Table->Length < sizeof (ACPI_TABLE_HEADER))
{
fprintf (stderr, "Table length (0x%8.8X) is invalid\n",
Table->Length);
diff --git a/source/tools/acpiexec/aehandlers.c b/source/tools/acpiexec/aehandlers.c
index 5272f4170133..aad27056a301 100644
--- a/source/tools/acpiexec/aehandlers.c
+++ b/source/tools/acpiexec/aehandlers.c
@@ -214,6 +214,7 @@ AeCtrlCHandler (
}
}
+ (void) AcpiOsTerminate ();
exit (0);
}
diff --git a/source/tools/acpiexec/aemain.c b/source/tools/acpiexec/aemain.c
index dbd030135742..3562ff9141ae 100644
--- a/source/tools/acpiexec/aemain.c
+++ b/source/tools/acpiexec/aemain.c
@@ -47,6 +47,20 @@
ACPI_MODULE_NAME ("aemain")
+/*
+ * Main routine for the ACPI user-space execution utility.
+ *
+ * Portability note: The utility 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.
+ */
+
+extern BOOLEAN AcpiGbl_DebugTimeout;
+
/* Local prototypes */
static int
@@ -58,15 +72,6 @@ static ACPI_STATUS
AcpiDbRunBatchMode (
void);
-static char *
-FlStrdup (
- char *String);
-
-static char **
-AsDoWildcard (
- char *DirectoryPathname,
- char *FileSpecifier);
-
#define AE_BUFFER_SIZE 1024
#define ASL_MAX_FILES 256
@@ -83,12 +88,10 @@ AsDoWildcard (
UINT8 AcpiGbl_RegionFillValue = 0;
BOOLEAN AcpiGbl_IgnoreErrors = FALSE;
BOOLEAN AcpiGbl_DbOpt_NoRegionSupport = FALSE;
-BOOLEAN AcpiGbl_DebugTimeout = FALSE;
UINT8 AcpiGbl_UseHwReducedFadt = FALSE;
BOOLEAN AcpiGbl_DoInterfaceTests = FALSE;
static UINT8 AcpiGbl_ExecutionMode = AE_MODE_COMMAND_LOOP;
static char BatchBuffer[AE_BUFFER_SIZE]; /* Batch command buffer */
-static char *FileList[ASL_MAX_FILES];
static AE_TABLE_DESC *AeTableListHead = NULL;
#define ACPIEXEC_NAME "AML Execution/Debug Utility"
@@ -364,10 +367,6 @@ main (
ACPI_TABLE_HEADER *Table = NULL;
UINT32 TableCount;
AE_TABLE_DESC *TableDesc;
- char **WildcardList;
- char *Filename;
- char *Directory;
- char *FullPathname;
ACPI_DEBUG_INITIALIZE (); /* For debug version only */
@@ -392,166 +391,137 @@ main (
AE_CHECK_OK (AcpiInitializeSubsystem, Status);
if (ACPI_FAILURE (Status))
{
- return (-1);
+ goto ErrorExit;
}
/* Get the command line options */
if (AeDoOptions (argc, argv))
{
- return (-1);
+ goto ErrorExit;
}
/* The remaining arguments are filenames for ACPI tables */
- if (argv[AcpiGbl_Optind])
+ if (!argv[AcpiGbl_Optind])
{
- AcpiGbl_DbOpt_tables = TRUE;
- TableCount = 0;
+ goto EnterDebugger;
+ }
- /* Get each of the ACPI table files on the command line */
+ AcpiGbl_DbOpt_tables = TRUE;
+ TableCount = 0;
- while (argv[AcpiGbl_Optind])
- {
- /* Split incoming path into a directory/filename combo */
-
- Status = FlSplitInputPathname (argv[AcpiGbl_Optind],
- &Directory, &Filename);
- if (ACPI_FAILURE (Status))
- {
- return (-1);
- }
-
- /* Expand wildcards (Windows only) */
-
- WildcardList = AsDoWildcard (Directory, Filename);
- if (!WildcardList)
- {
- return (-1);
- }
-
- while (*WildcardList)
- {
- FullPathname = AcpiOsAllocate (
- strlen (Directory) + strlen (*WildcardList) + 1);
-
- /* Construct a full path to the file */
-
- strcpy (FullPathname, Directory);
- strcat (FullPathname, *WildcardList);
-
- /* Get one table */
-
- Status = AcpiDbReadTableFromFile (FullPathname, &Table);
- if (ACPI_FAILURE (Status))
- {
- printf ("**** Could not get input table %s, %s\n",
- FullPathname, AcpiFormatException (Status));
- goto EnterDebugger;
- }
-
- AcpiOsFree (FullPathname);
- AcpiOsFree (*WildcardList);
- *WildcardList = NULL;
- WildcardList++;
-
- /* Ignore non-AML tables, we can't use them. Except for an FADT */
-
- if (!ACPI_COMPARE_NAME (Table->Signature, ACPI_SIG_FADT) &&
- !AcpiUtIsAmlTable (Table))
- {
- ACPI_WARNING ((AE_INFO,
- "Table %4.4s is not an AML table, ignoring",
- Table->Signature));
- AcpiOsFree (Table);
- continue;
- }
-
- /* Allocate and link a table descriptor */
-
- TableDesc = AcpiOsAllocate (sizeof (AE_TABLE_DESC));
- TableDesc->Table = Table;
- TableDesc->Next = AeTableListHead;
- AeTableListHead = TableDesc;
-
- TableCount++;
- }
-
- AcpiGbl_Optind++;
- }
+ /* Get each of the ACPI table files on the command line */
- /* Build a local RSDT with all tables and let ACPICA process the RSDT */
+ while (argv[AcpiGbl_Optind])
+ {
+ /* Get one entire table */
- Status = AeBuildLocalTables (TableCount, AeTableListHead);
+ Status = AcpiDbReadTableFromFile (argv[AcpiGbl_Optind], &Table);
if (ACPI_FAILURE (Status))
{
- return (-1);
+ printf ("**** Could not get table from file %s, %s\n",
+ argv[AcpiGbl_Optind], AcpiFormatException (Status));
+ goto ErrorExit;
}
- Status = AeInstallTables ();
- if (ACPI_FAILURE (Status))
- {
- printf ("**** Could not load ACPI tables, %s\n",
- AcpiFormatException (Status));
- goto EnterDebugger;
- }
+ /* Ignore non-AML tables, we can't use them. Except for an FADT */
- /*
- * Install most of the handlers.
- * Override some default region handlers, especially SystemMemory
- */
- Status = AeInstallEarlyHandlers ();
- if (ACPI_FAILURE (Status))
+ if (!ACPI_COMPARE_NAME (Table->Signature, ACPI_SIG_FADT) &&
+ !AcpiUtIsAmlTable (Table))
{
- goto EnterDebugger;
+ ACPI_INFO ((AE_INFO,
+ "Table [%4.4s] is not an AML table, ignoring",
+ Table->Signature));
+ AcpiOsFree (Table);
}
+ else
+ {
+ /* Allocate and link a table descriptor */
- /* Setup initialization flags for ACPICA */
+ TableDesc = AcpiOsAllocate (sizeof (AE_TABLE_DESC));
+ TableDesc->Table = Table;
+ TableDesc->Next = AeTableListHead;
+ AeTableListHead = TableDesc;
- InitFlags = (ACPI_NO_HANDLER_INIT | ACPI_NO_ACPI_ENABLE);
- if (!AcpiGbl_DbOpt_ini_methods)
- {
- InitFlags |= (ACPI_NO_DEVICE_INIT | ACPI_NO_OBJECT_INIT);
+ TableCount++;
}
- /*
- * Main initialization for ACPICA subsystem
- * TBD: Need a way to call this after the ACPI table "LOAD" command
- */
- Status = AcpiEnableSubsystem (InitFlags);
- if (ACPI_FAILURE (Status))
- {
- printf ("**** Could not EnableSubsystem, %s\n",
- AcpiFormatException (Status));
- goto EnterDebugger;
- }
+ AcpiGbl_Optind++;
+ }
- /*
- * Install handlers for "device driver" space IDs (EC,SMBus, etc.)
- * and fixed event handlers
- */
- AeInstallLateHandlers ();
+ /* Build a local RSDT with all tables and let ACPICA process the RSDT */
- /* Finish the ACPICA initialization */
+ Status = AeBuildLocalTables (TableCount, AeTableListHead);
+ if (ACPI_FAILURE (Status))
+ {
+ goto ErrorExit;
+ }
- Status = AcpiInitializeObjects (InitFlags);
- if (ACPI_FAILURE (Status))
- {
- printf ("**** Could not InitializeObjects, %s\n",
- AcpiFormatException (Status));
- goto EnterDebugger;
- }
+ Status = AeInstallTables ();
+ if (ACPI_FAILURE (Status))
+ {
+ printf ("**** Could not load ACPI tables, %s\n",
+ AcpiFormatException (Status));
+ goto EnterDebugger;
+ }
- AeMiscellaneousTests ();
+ /*
+ * Install most of the handlers.
+ * Override some default region handlers, especially SystemMemory
+ */
+ Status = AeInstallEarlyHandlers ();
+ if (ACPI_FAILURE (Status))
+ {
+ goto EnterDebugger;
+ }
+
+ /* Setup initialization flags for ACPICA */
+
+ InitFlags = (ACPI_NO_HANDLER_INIT | ACPI_NO_ACPI_ENABLE);
+ if (!AcpiGbl_DbOpt_ini_methods)
+ {
+ InitFlags |= (ACPI_NO_DEVICE_INIT | ACPI_NO_OBJECT_INIT);
+ }
+
+ /*
+ * Main initialization for ACPICA subsystem
+ * TBD: Need a way to call this after the ACPI table "LOAD" command
+ */
+ Status = AcpiEnableSubsystem (InitFlags);
+ if (ACPI_FAILURE (Status))
+ {
+ printf ("**** Could not EnableSubsystem, %s\n",
+ AcpiFormatException (Status));
+ goto EnterDebugger;
+ }
+
+ /*
+ * Install handlers for "device driver" space IDs (EC,SMBus, etc.)
+ * and fixed event handlers
+ */
+ AeInstallLateHandlers ();
+
+ /* Finish the ACPICA initialization */
+
+ Status = AcpiInitializeObjects (InitFlags);
+ if (ACPI_FAILURE (Status))
+ {
+ printf ("**** Could not InitializeObjects, %s\n",
+ AcpiFormatException (Status));
+ goto EnterDebugger;
}
+ AeMiscellaneousTests ();
+
+
EnterDebugger:
/* Exit if error above and we are in one of the batch modes */
if (ACPI_FAILURE (Status) && (AcpiGbl_ExecutionMode > 0))
{
- return (-1);
+ goto ErrorExit;
}
/* Run a batch command or enter the command loop */
@@ -572,10 +542,17 @@ EnterDebugger:
case AE_MODE_BATCH_SINGLE:
AcpiDbExecute (BatchBuffer, NULL, NULL, EX_NO_SINGLE_STEP);
+ Status = AcpiTerminate ();
break;
}
return (0);
+
+
+ErrorExit:
+
+ (void) AcpiOsTerminate ();
+ return (-1);
}
@@ -633,193 +610,3 @@ AcpiDbRunBatchMode (
Status = AcpiTerminate ();
return (Status);
}
-
-
-/******************************************************************************
- *
- * FUNCTION: FlStrdup
- *
- * DESCRIPTION: Local strdup function
- *
- *****************************************************************************/
-
-static char *
-FlStrdup (
- char *String)
-{
- char *NewString;
-
-
- NewString = AcpiOsAllocate (strlen (String) + 1);
- if (!NewString)
- {
- return (NULL);
- }
-
- strcpy (NewString, String);
- return (NewString);
-}
-
-
-/******************************************************************************
- *
- * FUNCTION: FlSplitInputPathname
- *
- * PARAMETERS: InputFilename - The user-specified ASL source file to be
- * compiled
- * OutDirectoryPath - Where the directory path prefix is
- * returned
- * OutFilename - Where the filename part is returned
- *
- * RETURN: Status
- *
- * DESCRIPTION: Split the input path into a directory and filename part
- * 1) Directory part used to open include files
- * 2) Filename part used to generate output filenames
- *
- *****************************************************************************/
-
-ACPI_STATUS
-FlSplitInputPathname (
- char *InputPath,
- char **OutDirectoryPath,
- char **OutFilename)
-{
- char *Substring;
- char *DirectoryPath;
- char *Filename;
-
-
- *OutDirectoryPath = NULL;
- *OutFilename = NULL;
-
- if (!InputPath)
- {
- return (AE_OK);
- }
-
- /* Get the path to the input filename's directory */
-
- DirectoryPath = FlStrdup (InputPath);
- if (!DirectoryPath)
- {
- return (AE_NO_MEMORY);
- }
-
- /* Convert backslashes to slashes in the entire path */
-
- UtConvertBackslashes (DirectoryPath);
-
- /* Backup to last slash or colon */
-
- Substring = strrchr (DirectoryPath, '/');
- if (!Substring)
- {
- Substring = strrchr (DirectoryPath, ':');
- }
-
- /* Extract the simple filename */
-
- if (!Substring)
- {
- DirectoryPath[0] = 0;
- Filename = FlStrdup (InputPath);
- }
- else
- {
- Filename = FlStrdup (Substring + 1);
- *(Substring + 1) = 0;
- }
-
- if (!Filename)
- {
- return (AE_NO_MEMORY);
- }
-
- *OutDirectoryPath = DirectoryPath;
- *OutFilename = Filename;
- return (AE_OK);
-}
-
-
-/******************************************************************************
- *
- * FUNCTION: AsDoWildcard
- *
- * PARAMETERS: DirectoryPathname - Path to parent directory
- * FileSpecifier - the wildcard specification (*.c, etc.)
- *
- * RETURN: Pointer to a list of filenames
- *
- * 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 or file does not exist */
-
- printf ("File or directory \"%s%s\" does not exist\n",
- DirectoryPathname, FileSpecifier);
- return (NULL);
- }
-
- /* 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
- if (!FileSpecifier)
- {
- return (NULL);
- }
-
- /*
- * 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
-}
diff --git a/source/tools/acpiexec/aetables.c b/source/tools/acpiexec/aetables.c
index 1ba876e25333..452546dd73f6 100644
--- a/source/tools/acpiexec/aetables.c
+++ b/source/tools/acpiexec/aetables.c
@@ -413,6 +413,8 @@ AeInstallTables (
void)
{
ACPI_STATUS Status;
+ ACPI_TABLE_HEADER Header;
+ ACPI_TABLE_HEADER *Table;
Status = AcpiInitializeTables (Tables, ACPI_MAX_INIT_TABLES, TRUE);
@@ -442,6 +444,28 @@ AeInstallTables (
AcpiFormatException (Status));
}
+ /* Test multiple table/UEFI support. First, get the headers */
+
+ Status = AcpiGetTableHeader (ACPI_SIG_UEFI, 1, &Header);
+ AE_CHECK_OK (AcpiGetTableHeader, Status);
+
+ Status = AcpiGetTableHeader (ACPI_SIG_UEFI, 2, &Header);
+ AE_CHECK_OK (AcpiGetTableHeader, Status);
+
+ Status = AcpiGetTableHeader (ACPI_SIG_UEFI, 3, &Header);
+ AE_CHECK_STATUS (AcpiGetTableHeader, Status, AE_NOT_FOUND);
+
+ /* Now get the actual tables */
+
+ Status = AcpiGetTable (ACPI_SIG_UEFI, 1, &Table);
+ AE_CHECK_OK (AcpiGetTable, Status);
+
+ Status = AcpiGetTable (ACPI_SIG_UEFI, 2, &Table);
+ AE_CHECK_OK (AcpiGetTable, Status);
+
+ Status = AcpiGetTable (ACPI_SIG_UEFI, 3, &Table);
+ AE_CHECK_STATUS (AcpiGetTable, Status, AE_NOT_FOUND);
+
return (AE_OK);
}
diff --git a/source/tools/acpiexec/aetables.h b/source/tools/acpiexec/aetables.h
index 410d5289b9ec..dd4e62169a4e 100644
--- a/source/tools/acpiexec/aetables.h
+++ b/source/tools/acpiexec/aetables.h
@@ -219,23 +219,38 @@ unsigned char EcdtCode[] =
unsigned char Uefi1Code[] =
{
0x55,0x45,0x46,0x49,0x36,0x00,0x00,0x00, /* 00000000 "UEFI6..." */
- 0x01,0x03,0x20,0x49,0x6E,0x74,0x65,0x6C, /* 00000008 ".. Intel" */
- 0x54,0x65,0x6D,0x70,0x6C,0x61,0x74,0x65, /* 00000010 "Template" */
+ 0x01,0x6E,0x20,0x49,0x6E,0x74,0x65,0x6C, /* 00000008 ".n Intel" */
+ 0x20,0x20,0x20,0x55,0x45,0x46,0x49,0x31, /* 00000010 " UEFI1" */
0x01,0x00,0x00,0x00,0x49,0x4E,0x54,0x4C, /* 00000018 "....INTL" */
- 0x26,0x06,0x13,0x20,0x00,0x01,0x02,0x03, /* 00000020 "&.. ...." */
+ 0x23,0x08,0x13,0x20,0x06,0x07,0x08,0x09, /* 00000020 "#.. ...." */
0x04,0x05,0x06,0x07,0x08,0x09,0x0A,0x0B, /* 00000028 "........" */
0x0C,0x0D,0x0E,0x0F,0x36,0x00 /* 00000030 "....6." */
};
unsigned char Uefi2Code[] =
{
- 0x55,0x45,0x46,0x49,0x36,0x00,0x00,0x00, /* 00000000 "UEFI6..." */
- 0x01,0xEB,0x20,0x49,0x6E,0x74,0x65,0x6C, /* 00000008 ".. Intel" */
- 0x54,0x65,0x6D,0x70,0x6C,0x61,0x74,0x65, /* 00000010 "Template" */
+ 0x55,0x45,0x46,0x49,0xAA,0x00,0x00,0x00, /* 00000000 "UEFI...." */
+ 0x01,0xE0,0x20,0x49,0x6E,0x74,0x65,0x6C, /* 00000008 ".. Intel" */
+ 0x20,0x20,0x20,0x55,0x45,0x46,0x49,0x32, /* 00000010 " UEFI2" */
0x01,0x00,0x00,0x00,0x49,0x4E,0x54,0x4C, /* 00000018 "....INTL" */
- 0x26,0x06,0x13,0x20,0x06,0x07,0x08,0x09, /* 00000020 "&.. ...." */
+ 0x23,0x08,0x13,0x20,0x67,0x45,0x23,0x01, /* 00000020 "#.. gE#." */
0x04,0x05,0x06,0x07,0x08,0x09,0x0A,0x0B, /* 00000028 "........" */
- 0x0C,0x0D,0x0E,0x0F,0x36,0x00 /* 00000030 "....6." */
+ 0x0C,0x0D,0x0E,0x0F,0x36,0x00,0x04,0x19, /* 00000030 "....6..." */
+ 0x00,0x56,0x34,0xF2,0x04,0x03,0x02,0x01, /* 00000038 ".V4....." */
+ 0x77,0x66,0x55,0x44,0x33,0x22,0x11,0x1E, /* 00000040 "wfUD3".." */
+ 0x1C,0x1F,0x14,0x10,0x0C,0x08,0x04,0xAB, /* 00000048 "........" */
+ 0x54,0x68,0x69,0x73,0x20,0x69,0x73,0x20, /* 00000050 "This is " */
+ 0x61,0x20,0x73,0x74,0x72,0x69,0x6E,0x67, /* 00000058 "a string" */
+ 0x00,0x5C,0x50,0x43,0x49,0x30,0x5C,0x41, /* 00000060 ".\PCI0\A" */
+ 0x42,0x43,0x44,0x00,0x36,0x00,0x55,0x00, /* 00000068 "BCD.6.U." */
+ 0x6E,0x00,0x69,0x00,0x63,0x00,0x6F,0x00, /* 00000070 "n.i.c.o." */
+ 0x64,0x00,0x65,0x00,0x20,0x00,0x53,0x00, /* 00000078 "d.e. .S." */
+ 0x74,0x00,0x72,0x00,0x69,0x00,0x6E,0x00, /* 00000080 "t.r.i.n." */
+ 0x67,0x00,0x00,0x00,0x58,0x5B,0x00,0x00, /* 00000088 "g...X[.." */
+ 0x00,0x00,0x00,0x00,0x41,0x42,0x43,0x44, /* 00000090 "....ABCD" */
+ 0x45,0x00,0x00,0x01,0x02,0x03,0x04,0x05, /* 00000098 "E......." */
+ 0x06,0x07,0x08,0x09,0x0A,0x0B,0x0C,0x0D, /* 000000A0 "........" */
+ 0x0E,0x0F /* 000000A8 ".." */
};
@@ -446,21 +461,7 @@ DefinitionBlock ("ssdt4.aml", "SSDT", 2, "Intel", "ssdt4", 0x00000004)
[0001] Revision : 01
[0001] Checksum : 9B
[0006] Oem ID : " Intel"
-[0008] Oem Table ID : "Template"
-[0004] Oem Revision : 00000001
-[0004] Asl Compiler ID : "INTL"
-[0004] Asl Compiler Revision : 20100528
-
-[0016] UUID Identifier : 03020100-0504-0706-0809-0A0B0C0D0E0F
-[0002] Data Offset : 0000
-
-
-[0004] Signature : "UEFI" [UEFI Boot Optimization Table]
-[0004] Table Length : 00000036
-[0001] Revision : 01
-[0001] Checksum : 9B
-[0006] Oem ID : " Intel"
-[0008] Oem Table ID : "Template"
+[0008] Oem Table ID : " UEFI1"
[0004] Oem Revision : 00000001
[0004] Asl Compiler ID : "INTL"
[0004] Asl Compiler Revision : 20100528
@@ -468,6 +469,39 @@ DefinitionBlock ("ssdt4.aml", "SSDT", 2, "Intel", "ssdt4", 0x00000004)
[0016] UUID Identifier : 09080706-0504-0706-0809-0A0B0C0D0E0F
[0002] Data Offset : 0000
+
+[004] Signature : "UEFI" /* UEFI Boot Optimization Table */
+[004] Table Length : 00000036
+[001] Revision : 01
+[001] Checksum : 9B
+[006] Oem ID : " Intel"
+[008] Oem Table ID : " UEFI2"
+[004] Oem Revision : 00000001
+[004] Asl Compiler ID : "INTL"
+[004] Asl Compiler Revision : 20100528
+
+[016] UUID Identifier : 01234567-0504-0706-0809-0A0B0C0D0E0F
+[002] Data Offset : 0000
+
+ Label : StartRecord
+ UINT8 : 4
+ UINT16 : $EndRecord - $StartRecord /* Should be 0x19 */
+ UINT24 : 123456 | F00000
+ UINT32 : 01020304
+ UINT56 : 11223344556677
+ UINT64 : 0102030405060708 * 4 - 200 / 100 | F0000
+ Label : EndRecord
+
+ UINT8 : AB
+ String : "This is a string"
+ DevicePath : "\PCI0\ABCD"
+ UINT16 : $StartRecord
+ Unicode : "Unicode String"
+ UINT64 : $EndRecord * 128
+
+ Buffer : 41 42 43 44 45
+ String : ""
+ GUID : 03020100-0504-0706-0809-0A0B0C0D0E0F
#endif
#endif /* __AETABLES_H__ */
diff --git a/source/tools/acpisrc/acpisrc.h b/source/tools/acpisrc/acpisrc.h
index c1bd992c6d7a..101083deed5b 100644
--- a/source/tools/acpisrc/acpisrc.h
+++ b/source/tools/acpisrc/acpisrc.h
@@ -123,6 +123,7 @@ extern BOOLEAN Gbl_WidenDeclarations;
extern BOOLEAN Gbl_IgnoreLoneLineFeeds;
extern BOOLEAN Gbl_HasLoneLineFeeds;
extern BOOLEAN Gbl_Cleanup;
+extern BOOLEAN Gbl_IgnoreTranslationEscapes;
extern void *Gbl_StructDefs;
#define PARAM_LIST(pl) pl
@@ -177,6 +178,7 @@ typedef struct acpi_conversion_table
ACPI_IDENTIFIER_TABLE *SourceConditionalTable;
ACPI_IDENTIFIER_TABLE *SourceMacroTable;
ACPI_TYPED_IDENTIFIER_TABLE *SourceStructTable;
+ ACPI_IDENTIFIER_TABLE *SourceSpecialMacroTable;
UINT32 SourceFunctions;
ACPI_STRING_TABLE *HeaderStringTable;
@@ -184,6 +186,7 @@ typedef struct acpi_conversion_table
ACPI_IDENTIFIER_TABLE *HeaderConditionalTable;
ACPI_IDENTIFIER_TABLE *HeaderMacroTable;
ACPI_TYPED_IDENTIFIER_TABLE *HeaderStructTable;
+ ACPI_IDENTIFIER_TABLE *HeaderSpecialMacroTable;
UINT32 HeaderFunctions;
} ACPI_CONVERSION_TABLE;
@@ -196,6 +199,7 @@ extern ACPI_CONVERSION_TABLE CleanupConversionTable;
extern ACPI_CONVERSION_TABLE StatsConversionTable;
extern ACPI_CONVERSION_TABLE CustomConversionTable;
extern ACPI_CONVERSION_TABLE LicenseConversionTable;
+extern ACPI_CONVERSION_TABLE IndentConversionTable;
/* Prototypes */
@@ -282,6 +286,11 @@ AsRemoveEmptyBlocks (
char *Filename);
void
+AsCleanupSpecialMacro (
+ char *Buffer,
+ char *Keyword);
+
+void
AsCountSourceLines (
char *Buffer,
char *Filename);
diff --git a/source/tools/acpisrc/ascase.c b/source/tools/acpisrc/ascase.c
index ea669a809a8d..919029a2cffb 100644
--- a/source/tools/acpisrc/ascase.c
+++ b/source/tools/acpisrc/ascase.c
@@ -92,7 +92,14 @@ AsLowerCaseString (
* Check for translation escape string -- means to ignore
* blocks of code while replacing
*/
- SubString2 = strstr (SubBuffer, AS_START_IGNORE);
+ if (Gbl_IgnoreTranslationEscapes)
+ {
+ SubString2 = NULL;
+ }
+ else
+ {
+ SubString2 = strstr (SubBuffer, AS_START_IGNORE);
+ }
if ((SubString2) &&
(SubString2 < SubString1))
diff --git a/source/tools/acpisrc/asconvrt.c b/source/tools/acpisrc/asconvrt.c
index 0f2da2b70fa9..76db87133017 100644
--- a/source/tools/acpisrc/asconvrt.c
+++ b/source/tools/acpisrc/asconvrt.c
@@ -525,7 +525,14 @@ AsReplaceString (
* Check for translation escape string -- means to ignore
* blocks of code while replacing
*/
- SubString2 = strstr (SubBuffer, AS_START_IGNORE);
+ if (Gbl_IgnoreTranslationEscapes)
+ {
+ SubString2 = NULL;
+ }
+ else
+ {
+ SubString2 = strstr (SubBuffer, AS_START_IGNORE);
+ }
if ((SubString2) &&
(SubString2 < SubString1))
diff --git a/source/tools/acpisrc/asfile.c b/source/tools/acpisrc/asfile.c
index d6915825a70f..e28a4cf0a777 100644
--- a/source/tools/acpisrc/asfile.c
+++ b/source/tools/acpisrc/asfile.c
@@ -307,6 +307,7 @@ AsConvertFile (
ACPI_IDENTIFIER_TABLE *LineTable;
ACPI_IDENTIFIER_TABLE *MacroTable;
ACPI_TYPED_IDENTIFIER_TABLE *StructTable;
+ ACPI_IDENTIFIER_TABLE *SpecialMacroTable;
switch (FileType)
@@ -319,6 +320,7 @@ AsConvertFile (
ConditionalTable = ConversionTable->SourceConditionalTable;
MacroTable = ConversionTable->SourceMacroTable;
StructTable = ConversionTable->SourceStructTable;
+ SpecialMacroTable = ConversionTable->SourceSpecialMacroTable;
break;
case FILE_TYPE_HEADER:
@@ -329,6 +331,7 @@ AsConvertFile (
ConditionalTable = ConversionTable->HeaderConditionalTable;
MacroTable = ConversionTable->HeaderMacroTable;
StructTable = ConversionTable->HeaderStructTable;
+ SpecialMacroTable = ConversionTable->HeaderSpecialMacroTable;
break;
default:
@@ -401,6 +404,14 @@ AsConvertFile (
}
}
+ if (SpecialMacroTable)
+ {
+ for (i = 0; SpecialMacroTable[i].Identifier; i++)
+ {
+ AsCleanupSpecialMacro (FileBuffer, SpecialMacroTable[i].Identifier);
+ }
+ }
+
/* Process the function table */
for (i = 0; i < 32; i++)
diff --git a/source/tools/acpisrc/asmain.c b/source/tools/acpisrc/asmain.c
index e34eff034bbc..9ce25a5df9c6 100644
--- a/source/tools/acpisrc/asmain.c
+++ b/source/tools/acpisrc/asmain.c
@@ -97,9 +97,10 @@ BOOLEAN Gbl_WidenDeclarations = FALSE;
BOOLEAN Gbl_IgnoreLoneLineFeeds = FALSE;
BOOLEAN Gbl_HasLoneLineFeeds = FALSE;
BOOLEAN Gbl_Cleanup = FALSE;
+BOOLEAN Gbl_IgnoreTranslationEscapes = FALSE;
#define AS_UTILITY_NAME "ACPI Source Code Conversion Utility"
-#define AS_SUPPORTED_OPTIONS "cdhlqsuv^y"
+#define AS_SUPPORTED_OPTIONS "cdhilqsuv^y"
/******************************************************************************
@@ -292,6 +293,7 @@ AsDisplayUsage (
ACPI_OPTION ("-c", "Generate cleaned version of the source");
ACPI_OPTION ("-h", "Insert dual-license header into all modules");
+ ACPI_OPTION ("-i", "Cleanup macro indentation");
ACPI_OPTION ("-l", "Generate Linux version of the source");
ACPI_OPTION ("-u", "Generate Custom source translation");
@@ -364,6 +366,16 @@ main (
ConversionTable = &LicenseConversionTable;
break;
+ case 'i':
+
+ /* Cleanup wrong indent result */
+
+ printf ("Cleaning up macro indentation\n");
+ ConversionTable = &IndentConversionTable;
+ Gbl_IgnoreLoneLineFeeds = TRUE;
+ Gbl_IgnoreTranslationEscapes = TRUE;
+ break;
+
case 's':
/* Statistics only */
diff --git a/source/tools/acpisrc/asremove.c b/source/tools/acpisrc/asremove.c
index fded3fd957fa..37b167bdc494 100644
--- a/source/tools/acpisrc/asremove.c
+++ b/source/tools/acpisrc/asremove.c
@@ -173,7 +173,14 @@ AsRemoveConditionalCompile (
* Check for translation escape string -- means to ignore
* blocks of code while replacing
*/
- Comment = strstr (SubString, AS_START_IGNORE);
+ if (Gbl_IgnoreTranslationEscapes)
+ {
+ Comment = NULL;
+ }
+ else
+ {
+ Comment = strstr (SubString, AS_START_IGNORE);
+ }
if ((Comment) &&
(Comment < SubBuffer))
@@ -611,3 +618,72 @@ AsRemoveDebugMacros (
AsReplaceString ("return_acpi_status", "return", REPLACE_WHOLE_WORD, Buffer);
AsReplaceString ("return_VALUE", "return", REPLACE_WHOLE_WORD, Buffer);
}
+
+
+/******************************************************************************
+ *
+ * FUNCTION: AsCleanupSpecialMacro
+ *
+ * DESCRIPTION: For special macro invocations (invoked without ";" at the end
+ * of the lines), do the following:
+ * 1. Remove spaces appended by indent at the beginning of lines.
+ * 2. Add an empty line between two special macro invocations.
+ *
+ ******************************************************************************/
+
+void
+AsCleanupSpecialMacro (
+ char *Buffer,
+ char *Keyword)
+{
+ char *SubString;
+ char *SubBuffer;
+ char *LastNonSpace;
+
+
+ SubBuffer = Buffer;
+ SubString = Buffer;
+
+ while (SubString)
+ {
+ SubString = strstr (SubBuffer, Keyword);
+
+ if (SubString)
+ {
+ /* Find start of the line */
+
+ SubBuffer = SubString;
+ while (*(SubBuffer - 1) == ' ')
+ {
+ SubBuffer--;
+ }
+
+ if (*(SubBuffer - 1) == '\n')
+ {
+ /* Find last non-space character */
+
+ LastNonSpace = SubBuffer - 1;
+ while (isspace ((int) *LastNonSpace))
+ {
+ LastNonSpace--;
+ }
+
+ if (*LastNonSpace != '\\')
+ {
+ /* Remove the extra spaces */
+
+ SubString = AsRemoveData (SubBuffer, SubString);
+
+ /* Enforce an empty line between the invocations */
+
+ if (*(SubBuffer - 2) == ')')
+ {
+ AsInsertData (SubBuffer, "\n", 1);
+ }
+ }
+ }
+
+ SubBuffer = SubString + strlen (Keyword);
+ }
+ }
+}
diff --git a/source/tools/acpisrc/astable.c b/source/tools/acpisrc/astable.c
index d38252301ec7..081767b19ea2 100644
--- a/source/tools/acpisrc/astable.c
+++ b/source/tools/acpisrc/astable.c
@@ -168,10 +168,6 @@ ACPI_STRING_TABLE LinuxDataTypes[] = {
{"INT16", "s16", REPLACE_WHOLE_WORD},
{"INT8", "s8", REPLACE_WHOLE_WORD},
- /* Include file paths */
-
- {"\"acpi.h\"", "<acpi/acpi.h>", REPLACE_WHOLE_WORD},
-
{NULL, NULL, 0}
};
@@ -694,6 +690,44 @@ ACPI_IDENTIFIER_TABLE LinuxConditionalIdentifiers[] = {
{NULL}
};
+
+ACPI_STRING_TABLE LinuxSpecialStrings[] = {
+
+ /* Include file paths */
+
+ {"\"acpi.h\"", "<acpi/acpi.h>", REPLACE_WHOLE_WORD},
+ {"\"acpiosxf.h\"", "<acpi/acpiosxf.h>", REPLACE_WHOLE_WORD},
+ {"\"acpixf.h\"", "<acpi/acpixf.h>", REPLACE_WHOLE_WORD},
+ {"\"acbuffer.h\"", "<acpi/acbuffer.h>", REPLACE_WHOLE_WORD},
+ {"\"acconfig.h\"", "<acpi/acconfig.h>", REPLACE_WHOLE_WORD},
+ {"\"acexcep.h\"", "<acpi/acexcep.h>", REPLACE_WHOLE_WORD},
+ {"\"acnames.h\"", "<acpi/acnames.h>", REPLACE_WHOLE_WORD},
+ {"\"acoutput.h\"", "<acpi/acoutput.h>", REPLACE_WHOLE_WORD},
+ {"\"acrestyp.h\"", "<acpi/acrestyp.h>", REPLACE_WHOLE_WORD},
+ {"\"actbl.h\"", "<acpi/actbl.h>", REPLACE_WHOLE_WORD},
+ {"\"actbl1.h\"", "<acpi/actbl1.h>", REPLACE_WHOLE_WORD},
+ {"\"actbl2.h\"", "<acpi/actbl2.h>", REPLACE_WHOLE_WORD},
+ {"\"actbl3.h\"", "<acpi/actbl3.h>", REPLACE_WHOLE_WORD},
+ {"\"actypes.h\"", "<acpi/actypes.h>", REPLACE_WHOLE_WORD},
+ {"\"platform/acenv.h\"", "<acpi/platform/acenv.h>", REPLACE_WHOLE_WORD},
+ {"\"acgcc.h\"", "<acpi/platform/acgcc.h>", REPLACE_WHOLE_WORD},
+ {"\"aclinux.h\"", "<acpi/platform/aclinux.h>", REPLACE_WHOLE_WORD},
+
+ {NULL, NULL, 0}
+};
+
+
+ACPI_IDENTIFIER_TABLE LinuxSpecialMacros[] = {
+
+ {"ACPI_EXPORT_SYMBOL"},
+ {"ACPI_EXPORT_SYMBOL_INIT"},
+ {"ACPI_HW_DEPENDENT_RETURN_OK"},
+ {"ACPI_HW_DEPENDENT_RETURN_STATUS"},
+ {"ACPI_HW_DEPENDENT_RETURN_VOID"},
+ {NULL}
+};
+
+
ACPI_CONVERSION_TABLE LinuxConversionTable = {
DualLicenseHeader,
@@ -708,6 +742,7 @@ ACPI_CONVERSION_TABLE LinuxConversionTable = {
NULL,
LinuxEliminateMacros,
AcpiIdentifiers,
+ NULL,
(CVT_COUNT_TABS | CVT_COUNT_NON_ANSI_COMMENTS | CVT_COUNT_LINES |
CVT_CHECK_BRACES | CVT_TRIM_LINES | CVT_BRACES_ON_SAME_LINE |
CVT_MIXED_CASE_TO_UNDERSCORES | CVT_LOWER_CASE_IDENTIFIERS |
@@ -721,6 +756,7 @@ ACPI_CONVERSION_TABLE LinuxConversionTable = {
LinuxConditionalIdentifiers,
NULL,
AcpiIdentifiers,
+ NULL,
(CVT_COUNT_TABS | CVT_COUNT_NON_ANSI_COMMENTS | CVT_COUNT_LINES |
CVT_TRIM_LINES | CVT_MIXED_CASE_TO_UNDERSCORES |
CVT_LOWER_CASE_IDENTIFIERS | CVT_TRIM_WHITESPACE |
@@ -746,6 +782,7 @@ ACPI_CONVERSION_TABLE CleanupConversionTable = {
NULL,
NULL,
NULL,
+ NULL,
(CVT_COUNT_TABS | CVT_COUNT_NON_ANSI_COMMENTS | CVT_COUNT_LINES |
CVT_CHECK_BRACES | CVT_TRIM_LINES | CVT_TRIM_WHITESPACE),
@@ -756,6 +793,7 @@ ACPI_CONVERSION_TABLE CleanupConversionTable = {
NULL,
NULL,
NULL,
+ NULL,
(CVT_COUNT_TABS | CVT_COUNT_NON_ANSI_COMMENTS | CVT_COUNT_LINES |
CVT_TRIM_LINES | CVT_TRIM_WHITESPACE),
};
@@ -774,6 +812,7 @@ ACPI_CONVERSION_TABLE StatsConversionTable = {
NULL,
NULL,
NULL,
+ NULL,
(CVT_COUNT_TABS | CVT_COUNT_NON_ANSI_COMMENTS | CVT_COUNT_LINES |
CVT_COUNT_SHORTMULTILINE_COMMENTS),
@@ -784,6 +823,7 @@ ACPI_CONVERSION_TABLE StatsConversionTable = {
NULL,
NULL,
NULL,
+ NULL,
(CVT_COUNT_TABS | CVT_COUNT_NON_ANSI_COMMENTS | CVT_COUNT_LINES |
CVT_COUNT_SHORTMULTILINE_COMMENTS),
};
@@ -808,6 +848,7 @@ ACPI_CONVERSION_TABLE LicenseConversionTable = {
NULL,
NULL,
NULL,
+ NULL,
(CVT_COUNT_TABS | CVT_COUNT_NON_ANSI_COMMENTS | CVT_COUNT_LINES |
CVT_COUNT_SHORTMULTILINE_COMMENTS),
@@ -818,6 +859,7 @@ ACPI_CONVERSION_TABLE LicenseConversionTable = {
NULL,
NULL,
NULL,
+ NULL,
(CVT_COUNT_TABS | CVT_COUNT_NON_ANSI_COMMENTS | CVT_COUNT_LINES |
CVT_COUNT_SHORTMULTILINE_COMMENTS),
};
@@ -897,6 +939,7 @@ ACPI_CONVERSION_TABLE CustomConversionTable = {
NULL,
NULL,
NULL,
+ NULL,
(CVT_COUNT_TABS | CVT_COUNT_NON_ANSI_COMMENTS | CVT_COUNT_LINES |
CVT_TRIM_LINES | CVT_TRIM_WHITESPACE),
@@ -907,6 +950,44 @@ ACPI_CONVERSION_TABLE CustomConversionTable = {
NULL,
NULL,
NULL,
+ NULL,
+ (CVT_COUNT_TABS | CVT_COUNT_NON_ANSI_COMMENTS | CVT_COUNT_LINES |
+ CVT_TRIM_LINES | CVT_TRIM_WHITESPACE),
+};
+
+
+/******************************************************************************
+ *
+ * Indentation result fixup table
+ *
+ ******************************************************************************/
+
+ACPI_CONVERSION_TABLE IndentConversionTable = {
+
+ NULL,
+ FLG_NO_CARRIAGE_RETURNS,
+
+ NULL,
+
+ /* C source files */
+
+ LinuxSpecialStrings,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ LinuxSpecialMacros,
+ (CVT_COUNT_TABS | CVT_COUNT_NON_ANSI_COMMENTS | CVT_COUNT_LINES |
+ CVT_TRIM_LINES | CVT_TRIM_WHITESPACE),
+
+ /* C header files */
+
+ LinuxSpecialStrings,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ LinuxSpecialMacros,
(CVT_COUNT_TABS | CVT_COUNT_NON_ANSI_COMMENTS | CVT_COUNT_LINES |
CVT_TRIM_LINES | CVT_TRIM_WHITESPACE),
};
diff --git a/source/tools/acpixtract/acpixtract.c b/source/tools/acpixtract/acpixtract.c
index efed9364545c..c06e3757dea3 100644
--- a/source/tools/acpixtract/acpixtract.c
+++ b/source/tools/acpixtract/acpixtract.c
@@ -95,6 +95,9 @@ AxConvertLine (
char *InputLine,
unsigned char *OutputData);
+static int
+AxIsEmptyLine (
+ char *Buffer);
typedef struct AxTableInfo
{
@@ -181,6 +184,41 @@ AxCheckAscii (
}
+/******************************************************************************
+ *
+ * FUNCTION: AxIsEmptyLine
+ *
+ * PARAMETERS: Buffer - Line from input file
+ *
+ * RETURN: TRUE if line is empty (zero or more blanks only)
+ *
+ * DESCRIPTION: Determine if an input line is empty.
+ *
+ ******************************************************************************/
+
+static int
+AxIsEmptyLine (
+ char *Buffer)
+{
+
+ /* Skip all spaces */
+
+ while (*Buffer == ' ')
+ {
+ Buffer++;
+ }
+
+ /* If end-of-line, this line is empty */
+
+ if (*Buffer == '\n')
+ {
+ return (1);
+ }
+
+ return (0);
+}
+
+
/*******************************************************************************
*
* FUNCTION: AxNormalizeSignature
@@ -345,8 +383,8 @@ AxCountTableInstances (
{
/* Ignore empty lines and lines that start with a space */
- if ((InstanceBuffer[0] == ' ') ||
- (InstanceBuffer[0] == '\n'))
+ if (AxIsEmptyLine (InstanceBuffer) ||
+ (InstanceBuffer[0] == ' '))
{
continue;
}
@@ -506,8 +544,8 @@ AxExtractTables (
/* Ignore empty lines and lines that start with a space */
- if ((LineBuffer[0] == ' ') ||
- (LineBuffer[0] == '\n'))
+ if (AxIsEmptyLine (LineBuffer) ||
+ (LineBuffer[0] == ' '))
{
continue;
}
@@ -574,7 +612,7 @@ AxExtractTables (
/* Empty line or non-data line terminates the data */
- if ((LineBuffer[0] == '\n') ||
+ if (AxIsEmptyLine (LineBuffer) ||
(LineBuffer[0] != ' '))
{
fclose (OutputFile);
@@ -672,15 +710,15 @@ AxListTables (
/* Dump the headers for all tables found in the input file */
- printf ("\nSignature Length Revision OemId OemTableId"
+ printf ("\nSignature Length Revision OemId OemTableId"
" OemRevision CompilerId CompilerRevision\n\n");
while (fgets (LineBuffer, AX_LINE_BUFFER_SIZE, InputFile))
{
/* Ignore empty lines and lines that start with a space */
- if ((LineBuffer[0] == ' ') ||
- (LineBuffer[0] == '\n'))
+ if (AxIsEmptyLine (LineBuffer) ||
+ (LineBuffer[0] == ' '))
{
continue;
}
@@ -698,7 +736,7 @@ AxListTables (
if (!strncmp (TableHeader->Signature, "RSD PTR ", 8))
{
AxCheckAscii ((char *) &Header[9], 6);
- printf ("%8.4s \"%6.6s\"\n", "RSDP", &Header[9]);
+ printf ("%7.4s \"%6.6s\"\n", "RSDP", &Header[9]);
TableCount++;
continue;
}
@@ -713,7 +751,7 @@ AxListTables (
/* Signature and Table length */
TableCount++;
- printf ("%8.4s % 7d", TableHeader->Signature, TableHeader->Length);
+ printf ("%7.4s 0x%8.8X", TableHeader->Signature, TableHeader->Length);
/* FACS has only signature and length */
@@ -729,7 +767,7 @@ AxListTables (
AxCheckAscii (TableHeader->OemTableId, 8);
AxCheckAscii (TableHeader->AslCompilerId, 4);
- printf (" %2.2X \"%6.6s\" \"%8.8s\" %8.8X \"%4.4s\" %8.8X\n",
+ printf (" 0x%2.2X \"%6.6s\" \"%8.8s\" 0x%8.8X \"%4.4s\" 0x%8.8X\n",
TableHeader->Revision, TableHeader->OemId,
TableHeader->OemTableId, TableHeader->OemRevision,
TableHeader->AslCompilerId, TableHeader->AslCompilerRevision);